
#include<iostream>
using namespace std;
void swap(int& a, int& b)
{
int temp;
temp = a;
a = b;
b = temp;
}
void quickSort(int arr[], int low, int high)
{
if (low < high)
{
int pivot = arr[high];
int i= low,j=low;
while (j < high)
{
while (arr[j] < pivot && j < high)
swap(arr[i++], arr[j++]);
while (arr[j] >= pivot && j < high)
j++;
}
swap(arr[i], arr[j]);
quickSort(arr, low, i - 1);
quickSort(arr, i + 1, high);
}
}
int main()
{
int arr[] = { 2,3,56,4,8,5,89,9,7,67,8,0};
int num = sizeof(arr) / sizeof(arr[0]);
quickSort(arr, 0, num - 1);
for (int i = 0;i < num;i++)
cout << arr[i] << " ";
return 0;
}
