int Partition(int r[],int first,int end){
int i = first,j = end;
while(i < j){
while(i < j&&r[i]<=r[j]) j--;
if(i < j){
int t = r[i];
r[i] = r[j];
r[j] = t;
i++;
}
while(i < j&&r[i]<=r[j]) i++;
if(i < j){
int t = r[i];
r[i] = r[j];
r[j] = t;
j--;
}
}
return i;
}
void QuickSort(int r[],int first,int end){
if(first < end){
int p = Partition(r,first,end);
QuickSort(r,first,p-1);
QuickSort(r,p+1,end);
}
}
最好时间复杂度:O(N*log2N)
平均时间复杂度:O(N*log2N)
最坏时间复杂度:O(N2)
稳定性:不稳定