Quicksort with median-of-three