//Partition the array int i = left,j = right - 2; if (j >= 0) { for(;;) { while (a[i].compareTo(a[pivot])< 0) { i++; } while(a[j].compareTo(a[pivot]) > 0) { j--; } if (i >= j) break; swap(a,i,j); } } //Put the pivot at ith position of the array swap(a,i,right-1); //Now all the elements to the right of i are less than //it and all the elements to the left of i are greater //than it. So partition the array and //recursively call quicksort on the left and right partition doQuickSort(a, left, i-1); doQuickSort(a, i+1, right);

1 comment:

About Me

I am a senior software engineer with interests in designing and developing mission-critical applications on Java platform. I love developing software applications and Java Technology. I am also deeply interested in topics such as cloud computing and Web 2.0 technologies. I will be using this blog to share my experience, thoughts and knowledge about matters related to software technology.