#include<iostream>
using namespace std;
int Partition(int r[], int low, int high)
{
int i = low, j = high, pivot = r[low];
while (i<j)
{
while (i<j&&r[j]>pivot)
j--;
if (i < j)
swap(r[i++], r[j]);
while (i < j&&r[i] <= pivot)
i++;
if (i < j)
swap(r[i], r[j--]);
}
return i;//返回基准元素的位置
}
void QuickSort(int R[], int low, int high)
{
int mid;
if (low < high)
{
mid = Partition(R, low, high);
QuickSort(R, low, mid -1);
QuickSort(R, mid, high);
}
}