








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









do { do i++; while(x [i] < pivot); do j--; while( x[j] > pivot); if (i<j) Interchange(x, i, j); } while (i<j); Interchange(x, left, j); Quicksort(x, left, j-1); Quicksort(x, j+1, right); } }
Interchange (int x[ ], int k, int c) { int temp; temp = x[k]; x[k] = x[c]; x[c] = temp; } The best case of Quick sort is O(n logn) and the worst case is O(n 2 ).