How would you write qsort?
Answer / hardik
#include<stdio.h>
#include<conio.h>
void sort(int,int);
int *arr;
void main()
{
clrscr();
int n,ub,lb=0,i;
printf("ENTER NO OF VALUES U WANT TO ENTER : ");
scanf("%d",&ub);
for(i=0;i<ub;i++)
{
printf("\ENter value : ");
scanf("%d",&arr[i]);
}
sort(lb,ub);
for(i=0;i<ub;i++)
printf("%d\t",arr[i]);
getch();
}
void sort(int lb,int ub)
{
int flag=1,temp,key,i,j;
i=lb; j=ub;
key=arr[i];
if(lb<ub)
{
while(flag)
{
i++;
while(key>arr[i])
i++;
while(key<arr[j])
j--;
if(i<j)
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
else
flag=0;
}
temp=arr[lb];
arr[lb]=arr[j];
arr[j]=temp;
sort(lb,j-1);
sort(j+1,ub);
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
In CMM or CMMI certified organizations,we assess only the standard software processes of the organization. We do not assess the organizations other functional departments like HR or Admin. Then how can we certify the entire organization as CMM level company?? We have assessed only software related activities. Right. There is no relation with other departments like Accounts, HR or Admin. Then how can we claim that the whole company is a CMM certified company?
How does free() know how many bytes to free?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
which one is better structure or union?(other than the space occupied )
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
Explain how do you determine a file’s attributes?
write a program to display all prime numbers
what value is returned to operating system after program execution?
What is a keyword?
What is the process to create increment and decrement stamen in c?
What is the meaning of && in c?