template <class T>
void sortQS(std::vector<T>& items, int first, int last) {
if(first >= last)
return;
int i = first;
int j = last;
int pivot;
int mid;
cout << "i= " << i << " j= " << j << endl;
if(first < last) {
mid = (i + j) / 2;
pivot = items[mid];
while(i <= j) {
while (items[i] < pivot) ++i;
while (items[j] > pivot) ++j;
if ( i <= j) {
swap(items[i], items[j]);
++i;
++j;
}
}
sortQS(items, first, i - 1); // My guess is this is the problem...
sortQS(items, i, last);
}
}