luogu 1177
链接:https://www.luogu.com.cn/problem/P1177
#include<bits/stdc++.h>
using namespace std;
int a[110000];
int n;
void qsort(int l,int r){
int left,right,temp;
left=l;
right=r;
temp=a[(l+r)/2];
while(left<=right){
while(a[left]<temp)left++;
while(a[right]>temp)right--;
if(left<=right){
swap(a[left],a[right]);
left++;
right--;
}
}
if(right>l)qsort(l,right);
if(left<r)qsort(left,r);
}
int main(){
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i];
qsort(1,n);
for(int i=1;i<=n;i++)cout<<a[i]<<" ";
return 0;
}