Quicksort - An Example: Left Left+1 Right
Quicksort - An Example: Left Left+1 Right
partition( A, left, right) rarranges A[left .. right] and finds and returns an
integer q, such that
a pivot, A[q] = pivot, A[q+1], ..., A[right] > pivot,
A[left], ..., A[q–1] <
where pivot is the middle element of a[left..right], before partitioning. (To
choose the pivot element differently, simply modify the assignment to m.)
m = ¬left + right¼ / 2;
Integer partition( T[] A, Integer left, Integer right)