median as pivot quicksort algorithm