Alt Quick

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

void quicksort(int st,int dr)

{
int i=st, j=dr;
int pivot = v[(st+dr)/2];
while(i<=j)
{
while(v[i]<pivot)
++i;
while(v[j]>pivot)
--j;
if(i<=j)
{
int tmp = v[i];
v[i]=v[j];
v[j]=tmp;
++i;
--j;
}
}
if(st<j)
quicksort(st,j);
if(i<dr)
quicksort(i,dr);
}

You might also like