The Hidden Complexity of Quicksort

I had already solved the problem using merge sort, but I wanted to give it another shot with quicksort.