Quick Sort program | Improvement | Choose pivot item = median | TODO


private static void sort(Comparable[] a, int lo, int hi)
 {
 if (hi <= lo) return;
 int m = medianOf3(a, lo, lo + (hi - lo)/2, hi);
 swap(a, lo, m);
 int j = partition(a, lo, hi);
 sort(a, lo, j-1);
 sort(a, j+1, hi);
 }

Comments

Popular posts from this blog

SQL basic interview question

gsutil Vs Storage Transfer Service Vs Transfer Appliance