#include <bits/stdc++.h>
using namespace std;
const int n = 1e6 + 10;
int ww[n];
void quick_sort(int w[], int a,int b) {
if (a >= b)return ;
int mid = (a + b) >> 1, c = a - 1, d = b + 1, e = w[mid];
while (c < d) {
do c++; while (w[c] < e);
do d--; while (w[d] > e);
if (c < d) { int temp = w[c]; w[c] = w[d]; w[d] = temp; };
};
quick_sort(w, a, d); quick_sort(w, d+1, b);
}
快速排序(yxc版)
最新推荐文章于 2024-07-15 22:53:16 发布