Last Updated : 24 Dec, 2018

Which of the following option is correct regarding quick sort?
(A) If (n/4)th smallest element is selected in O(n) time as pivot element. Then the worst case time complexity of quicksort will be θ(n*n).
(B) If a pivot element is selected which split the list into two sublists. Each of which contains at least 1/5th of the element. If T(n) is the number of comparison to sort n elements the T(n) = T(n / 4) + T(4n / 5) + n.
(C) The tightest upper bound for the worst case performance of quicksort if the middle element has been chosen as the pivot is O(nlogn).
(D) If pivot element is chosen randomly then worst case time complexity to sort n element is O(n2).


Answer: (C)

Explanation: The recurrence relation if the n/4th element is selected as pivot element:

T(n) = T(n/4) + T(3n/4) + O(n) 

Which on solving,

T(n) = θ(nlogn) 

But the tightest upper bound for the worst case performance of quicksort if the middle element has been chosen as the pivot is O(n2).

So, only option (C) is false.


Quiz of this Question


Share your thoughts in the comments