标签:
int partition(int arr[], int low, int high)
{
int pivot = arr[high];
int i = low-1;
for (int j = low; j < high; j++)
{
if(arr[j] <= pivot)
{
i++;
swap(arr[i], arr[j]);
}
}
swap(arr[i+1],arr[high]);
return i+1;
}
void quickSort(int arr[], int low, int high)
{
if(low < high)
{
int mid = partition(arr[], low, high);
quickSort(arr[], low, mid-1);
quickSort(arr[], mid+1, up);
}
}
标签:
原文地址:http://www.cnblogs.com/coderchuanyu/p/4677641.html