void quickSort(std::vector<int>& a, int from, int to)
{
if(from >= to) return;
int p = partition(a, from, to);
quickSort(a, from, p);
quickSort(a, p + 1, to);
}
int partition(std::vector<int>& a, int from, int to)
{
int pivot = a[from];
int i = from - 1;
int j = to + 1;
while(i < j)
{
i++; if(a[i] < pivot) i++;
j--; if(a[j] > pivot) j--;
if(i < j)
{
swap(a[i], a[j]);
}
}
return j;
}
void swap(int& a, int& b)
{
int temp = a;
a = b;
b = temp;
}