Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void quickSortR(int* a, int N) {
- int i = 0, j = N-1;
- int temp, p;
- p = a[N>>1];
- do{
- while ( a[i] < p ) i++;
- while ( a[j] > p ) j--;
- if (i <= j)
- {
- temp = a[i]; a[i] = a[j]; a[j] = temp;
- i++; j--;
- }
- }while(i<=j);
- if ( j > 0 ) quickSortR(a, j+1);
- if ( N-1 > i ) quickSortR(a+i, N-i);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement