Again we use a wrapper function quickSort(vector<T>& vec) to start the recursive quick sort function. It means that main does not have to provide the start and end indices.
Try running this interactive to see how the process plays out. As you do so, pay attention to when elements turn white. Those elements are in their final sorted position. Each partition step places one element (the pivot) into its final sorted position. Quick sort then recursively sorts the left and right partitions around that pivot.
This reverses the order of the two 1s. Recall that any time elements are swapping across large distance without consideration for other βequalβ elements, an algorithm is going to almost certainly be unstable. This is the case for quick sort.