#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define Max 11
void quicksort(int *a,int begin,int end){
if(begin>=end)return;
int left=begin;
int right=end;
int key=left;
while(left<right){
while(left<right&&a[key]<=a[right])right--;
while(left<right&&a[key]>=a[left])left++;
int temp=a[left];
a[left]=a[right];
a[right]=temp;
}
int temp=a[key];
a[key]=a[right];
a[right]=temp;
key=right;
quicksort(a,begin,key-1);
quicksort(a,key+1,end);
}
int main(){
int length;
cout<<"input the length:";
cin>>length;
int data[length+1];
cout<<"input the array:";
for(int i=1;i<=length;i++){
int a;
cin>>a;
data[i]=a;
}
quicksort(data,1,length);
for(int i=1;i<=length;i++){
cout<<data[i]<<" ";
}
}