、、、
include [HTML_REMOVED]
using namespace std;
const int MAXN = 100010;
int a[MAXN];
void quick_sort(int l, int r){
if(l >= r) return;
int x = a[(l + r) / 2];
int i = l - 1,j = r + 1;
while(i < j){
do i++; while(a[i] < x);
do j–; while(a[j] > x);
if(i < j) swap(a[i],a[j]);
}
quick_sort(l, j);
quick_sort(j + 1, r);
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for(int i = 0; i < n; i) cin >> a[i];
quick_sort(0, n - 1);
for(int i = 0; i < n; i) cout << a[i] << ” “;
return 0;
}
、、、