#include <iostream>
using namespace std;
int Paritition1(int A[], int low, int high) {
int pivot = A[low];
while (low < high) {
while (low < high && A[high] >= pivot) {
--high;
}
A[low] = A[high];
while (low < high && A[low] <= pivot) {
++low;
}
A[high]=A[low];
}
A[low] = pivot;
return low;
}
void QuickSort(int A[], int low, int high)
{
if (low < high) {
int pivot = Paritition1(A, low, high);
QuickSort(A, low, pivot - 1);
QuickSort(A, pivot + 1, high);
}
}
int main()
{
int len = 6;
int aa[] = { 11,9,3,20,56,32};
int* a = aa;
for (int i = 0; i < len; i++)
cout << ' ' << a[i];
cout << endl;
QuickSort(a, 0 ,len-1);
for (int i = 0; i < len; i++)
cout << ' ' << a[i];
return 0;
}