quicksort example with median p