标签:
void quickSort( int left, int right, int *arr)
{
int i, j, temp;
if ( left >= right ) return;
temp = arr[left];
i = left;
j = right;
while ( i != j )
{
while ( arr[j] >= temp && i < j ) j--;
while ( arr[i] <= temp && i < j ) i++;
if ( i < j )
{
int t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
}
arr[left] = arr[i];
arr[i] = temp;
quickSort(left, i-1, arr);
quickSort(i+1, right, arr);
}
标签:
原文地址:http://www.cnblogs.com/kaishan1990/p/4992631.html