Skip to content
Related Articles

Related Articles

Algorithms | Sorting | Question 17

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 28 Jun, 2021
Improve Article
Save Article

In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an O(n) time algorithm. What is the worst case time complexity of the quick sort?

(A) \theta(n)
(B) \theta(nLogn)
(C) \theta(n^2)
(D) \theta(n^2 log n)
(A) A
(B) B
(C) C
(D) D

Answer: (B)

Explanation: The recursion expression becomes:

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

After solving the above recursion, we get \theta(nLogn).

Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!