#include<iostream>
#include<math.h>
#include<string.h>
#include<stdio.h>
#include <fstream>
using namespace std;
int sort(int array[],int n,int low,int high)
{
int i,j,x;
if(low<high)
{
i=low;
j=high;
x=array[low];
while(i<j)
{
while(i<j&&array[j]>x)
{
j--;
}
if(i<j)
{
array[i]=array[j];
i++;
}
while(i<j&&array[i]<=x)
{
i++;
}
if(i<j)
{
array[j]=array[i];
j--;
}
}
array[i]=x;
sort(array,n,low,i-1);
sort(array,n,i+1,high);
}
}
int main()
{
int array[10]={3,5,1,7,8,9,4,1,2,10};
int i;
for(i=0;i<10;i++)
{
cout<<array[i];
}
cout<<endl;
sort(array,10,0,9);
for(i=0;i<10;i++)
{
cout<<array[i]<<",";
}
cout<<endl;
return 0;
}