Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sort(int a[],int first, int last){
- int pivot, i, j, tmp;
- if (first<last){
- pivot = first;
- i = first;
- j = last;
- while(i<j){
- while(a[i]<=a[pivot]&&i<last)
- i++;
- while(a[j]>a[pivot])
- j--;
- if(i<j){
- temp=a[i];
- a[i] = a[j];
- a[j] = temp;
- }
- }
- temp = a[pivot];
- a[pivot] = a[j];
- a[j] = temp;
- sort(a,first,j-1);
- sort(a,j+1,last);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement