Consider the quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists, one of which contains one-fifth of the elements and the remaining elements are contained in the other sub-list. Let T(n) be the number of comparisons required to sort n elements. Then:
Show Hint
In recurrence relations, always include the partitioning cost (e.g., n) along with recursive calls for sub-problems.
Quicksort's time complexity is dictated by its partitioning method. For example, when the pivot divides the list into sections of n/5 and 4n/5 elements, the resulting recurrence relation is T(n) = T(n/5) + T(4n/5) + n. The 'n' term signifies the cost of the partitioning step, which involves comparing all n elements.