Extract get_pivot method for quick_sort.
Simplify prefix function.