Consider the Quicksort algorithm. Suppose there is a procedure for finding a pivot element which splits the list into two sub-lists each of which contains at least one-fifth of the elements. Let be the number of comparisons required to sort elements. Then
View worked solution
Answer: B
In the Quicksort algorithm, the list of size is partitioned into two sub-lists around a pivot element. The cost of this partitioning step is comparisons (represented here as ).
We are given that each of the two resulting sub-lists contains at least one-fifth of the elements. Let the sizes of the two sub-lists be and . This condition implies:
In the worst-case scenario that satisfies this condition, the split is as unbalanced as possible. This occurs when one sub-list is of the minimum possible size, , and the other sub-list is of the maximum possible size, .
Therefore, the recurrence relation for the number of comparisons is bounded by:
Hence, the correct option is B.
Free practice · Your answers on this page are not saved.
