-
-
Save ramsundarg/2ca3b3e83ac6879183360a028b2ae95c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void quicksort(int start,int end, int a[]) | |
{ | |
pivot = start; | |
lp = start+1; | |
rp = end; | |
if(start == end) | |
return; | |
while(lp<rp) | |
{ | |
while(a[lp]>a[pivot]) | |
lp++; | |
while(a[rp]<a[pivot]) | |
rp--; | |
swap(a[rp],a[lp]); | |
} | |
swap(a[pivot],a[lp]); | |
quicksort(pivot+1,lp,a); | |
quicksort(lp+1,end,a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment