快速排序伪代码
quicksort(A,p,r)
{
if p < r;
then q<- partition(A,p,r)
quicksort(A,p,q-1)
quicksort(A,p+1,r)
}
其中
partition(A,p,r)
{
x<-A[r]
i<-p-1
for j<-p to r-1
do if A[j]<= x
then i++;
exchange A[i]<->A[j]
exchange A[i+1]<->A[r]
return i+1
}