//快速排序主要采用递归的方式进行调用。
#include <iostream>
void swap(int s[],int i,int j)
{
int tmp = s[j];
s[j] = s[i];
s[i] = tmp;
}
int partition(int s[],int l,int r)
{
int low = l;
int pivot = s[l];
while(l<r && s[r] >= pivot)
r--;
while(l < r && s[l] <= pivot)
r++;
if (l < r)
swap(s,l,r);
swap(s,low,l);
return l;
}
void qsort(int s[],int l,int r)
{
int pivot;
if(l < r) {
pivot = partition(s,l,r);
qsort(s,l,pivot - 1);
qsort(s,pivot + 1, r);
}
}