You have an array of elements. Suppose you implement quicksort by always choosing the central element of the array as the pivot. Then the tightest upper bound for the worst case performance is
View worked solution
Answer: A
The correct option is A.
In Quicksort, the worst-case time complexity occurs when the pivot selection consistently results in highly unbalanced partitions (e.g., one partition of size and the other of size at each step).
Even if we choose the central element of the array as the pivot, we can always construct an adversarial input sequence where the central element is always the minimum (or maximum) element of the current subarray.
For such an input, the recurrence relation for the running time is:
Solving this recurrence yields:
Thus, the tightest upper bound for the worst-case performance remains .
Free practice · Your answers on this page are not saved.
