#include "iostream"
#include "vector"
using namespace std;
void qSort(int a[], int l, int r) {
if (l >= r)
return;
int i = l, j = r, key = a[l];
while (i < j) {
while (i < j && a[j] >= key) j--;
if (i < j) a[i++] = a[j];
while (i < j && a[i] < key) i++;
if (i < j) a[j--] = a[i];
}
a[i] = key;
qSort(a, l, i - 1);
qSort(a, i + 1, r);
}
int main() {
int a[] = {0, 1, 5, 2, 6, 7};
qSort(a, 0, 5);
for (int i = 0; i < 6; i++)
cout << a[i] << " ";
cout << endl;
}