#include <iostream>
using namespace std;
void sort(int *a, int start, int end)
{
if(start < end)
{
int key = a[start];
int low = start;
int high = end;
while(low < high)
{
while(low < high && a[high] > key)
{
high--;
}
a[low] = a[high];
while(low < high && a[low] < key)
{
low++;
}
a[high] = a[low];
}
a[low] = key;
sort(a,start,low-1);
sort(a,low+1,end);
}
}
void main()
{
int a[10] = {5,3,4,8,6,1,2,9,7,10};
sort(a,0,9);
for(int i=0;i<10;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
}