int partition(vector<int>& array, int left, int right) {
int i = left;
int j = right;
int temp = array[left];
while (i != j) {
while (i <j && temp <= array[j]) j --;
if (i < j) array[i] = array[j];
while (i < j && temp > array[i]) i ++;
if (i < j) array[j] = array[i];
}
array[i] = temp;
return i;
}
void quickSort(vector<int>& array, int left, int right) {
if (left < right) {
int dp = partition(array, left, right);
quickSort(array, left, dp - 1);
quickSort(array, dp + 1, right);
}
}