Reference implementation of quicksort.