#include<cstdio>
#include<algorithm>
using namespace std;
//对区间[left,right]进行划分,即进行一趟快速排序
int Partition(int A[],int left,int right){
int temp = A[left]; //将A[left]存放至临时变量temp
while(left<right){
while(A[right]>temp) right--;
A[left] = A[right];
while(A[left]<=temp) left++;
A[right] = A[left];
}
A[left] = temp;
return left;
}
//快速排序,left与right初值为序列首尾下标(例如1与n)
void quickSort(int A[],int left,int right){
if(left<right){
int pos = Partition(A,left,right);
quickSort(A,left,pos-1);
quickSort(A,pos+1,right);
}
}