QuickSort, median pivot choice, completed