Implementation of quicksort using three stacks and an upper bound on the number of comparisons.