The pseudocode of quicksort1:
Let the time taken by quicksort() be where = arr.length.
pivot takes time.partition() takes time ( is a constant).less.length. Then quicksort(less) takes time, and quicksort(greater) takes time.Substitute .
Now we solve for the upper bound.
It's pseudocode because you don't implement quicksort like this. Real quicksort is in-place because copying like ...rest is actually . Still, this is a correct (and ) implementation. ↩