I\'ve been poring over various tutorials and articles that discuss quicksort and quickselect, however my understanding of them is still shaky.
Given this code struct
btw, your code has a few bugs..
int quickSelect(int items[], int first, int last, int k) {
int pivot = partition(items, first, last);
if (k < pivot-first+1) { //boundary was wrong
return quickSelect(items, first, pivot, k);
} else if (k > pivot-first+1) {//boundary was wrong
return quickSelect(items, pivot+1, last, k-pivot);
} else {
return items[pivot];//index was wrong
}
}