QuickSort implemented correctly for different choices of pivot