if p < r;
mid = Partition(A,p,r)
Quicksort(A,p,mid - 1)
Quicksort(A,mid + 1,r)
x = A[r]
i = p-1
for j = p to r-1
if A[j] ≤ x
i = i + 1
exchange A[i] with A[j]
exchange A[i+1] with A[r]
return i+1
|
|