快速排序
一开始没有交换基准元素a[mid]和a[left],发现排序出错
void quick_sort(int left, int right) {
int mid = (left + right) >> 1;
int mark = a[mid];
if (left >= right) {
return;
}
int l = left, r = right;
swap(a[left], a[mid]);
while (l < r) {
while (a[r] >= mark && l < r) r--;
while (a[l] <= mark && l < r) l++;
if (l < r) swap(a[l], a[r]);
}
swap(a[left], a[l]);
quick_sort(left, l - 1);
quick_sort(l + 1, right);
}