#include <stdio.h>
void quick_sort (int ls[] , int first , int last)
{
if (first > last)
{
return ;
}
int i = first ;
int j = last ;
int tmp ;
while (i != j)
{
while (ls[j] >= ls[first] && i < j)
{
j-- ;
}
while (ls[i] <= ls[first] && i < j)
{
i++ ;
}
if (i<j)
{ tmp = ls[i];
ls[i] = ls[j];
ls[j] = tmp ;
}
}
tmp = ls[i] ;
ls[i] = ls[first] ;
ls[first] = tmp ;
quick_sort(ls, first , i-1);
quick_sort(ls, i+1 , last);
return ;
}
int main ()
{
int i , size ;
printf("please input some value\n");
scanf("%d",&size);
int ls[size+1] ;
for ( i = 1 ; i <= size ; i++ )
{
scanf("%d",&ls[i]);
}
quick_sort(ls,1,size);
for (i = 1 ; i <= size ; i++)
{
printf("%d ",ls[i]);
}
return 0 ;
}