Termination of quicksort