Update quicksort function

Still not fully tested; in particular, need to check whether left_of_pivot_max
and right_of_pivot_min are iterated at the right point in the algorithm.