Quick Sort
void main()
{
int x[20],size,i;
clrscr();
printf("\nEnter size of the array :");
scanf("%d",&size);
printf("\nEnter %d elements :",size);
for(i=0;i
j--;
if(i
temp=x[i];
x[i]=x[j];
x[j]=temp;
}
}
temp=x[pivot];
x[pivot]=x[j];
x[j]=temp;
quicksort(x,first,j-1);
quicksort(x,j+1,last);
}
}
0 comments:
Post a Comment