#include<stdio.h>
#include<vector>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include<unordered_set>
void fun(int *a, int n,int ii,int jj)
{
if (ii >= jj)
return;
int i = ii;
int j = jj;
int temp = a[i];
while (i < j)
{
while (j>i)
{
if (a[j] < temp)
{
a[i] = a[j];
break;
}
j--;
}
while (i<j)
{
if (a[i] > temp)
{
a[j] = a[i];
break;
}
i++;
}
}
a[i] = temp;
fun(a, n, ii, i - 1);
fun(a, n, i+1, jj);
int zz = 0;
}
int main()
{
int n = 5;
int a[5] = { 10,5,9,2,4 };
int i = 0;
int temp = a[i];
int j = n - 1;
fun(a, n,i,j);
int zz = 0;
}