关于快排
“`
“`void quicksort(int a[], int left, int right)
{
if (left >= right)
{
return;
}
int c = left;
int b = right;
int spot = a[left];
while (c < b)
{
while (b > c&&a[b] >= spot)//一定要注意=这个符号!!!
{
b–;
}
a[c] = a[b];
while (c < b&&a[c] <=spot)//一定要注意=这个符号!!!
{
c++;
}
a[b] = a[c];
}
a[c] = spot;
quicksort(a, left, c - 1);
quicksort(a, c + 1,right);
}