Taking help from the jean paul trembley book
Authore:- Maulin Desai
GNU/GPL :) :) */
#include
int main()
{
int m[]={42,23,74,11,65,58,94,36,99,87};
int lb=0;
int ub=9,i;
void q_sort(int m[],int lb,int ub);
q_sort(m,lb,ub);
for(i=0;i<10;i++)
{
printf("%d\t\t",m[i]);
}
return 0;
}
void q_sort(int m[],int lb,int ub)
{
int i,j,key,temp;
int flag=0;
i=lb+1;
j=ub;
key=m[lb];
while(flag==0)
{
if(lb
while(m[i]
while(m[j]>key)
j=j-1;
if(i
temp=m[i];
m[i]=m[j];
m[j]=temp;
}
else
{
flag=1;
temp=m[lb];
m[lb]=m[j];
m[j]=temp;
}
}
else
{
return;
}
}
q_sort(m,lb,j-1);
q_sort(m,j+1,ub);
}
wahhhhh
ReplyDeleteGNU/GPL
super like bro... :):)