Skip to content
Related Articles

Related Articles

Algorithms | Sorting | Question 23
  • Difficulty Level : Hard
  • Last Updated : 01 Mar, 2013

The number of elements that can be sorted in \Theta(logn) time using heap sort is

(A) \Theta(1)
(B) \Theta(\sqrt{logn})
(C) \Theta(Log n/(Log Log n))
(d) \Theta(Log n) 

(A) A
(B) B
(C) C
(D) D


Answer: (C)

Explanation: Time complexity of Heap Sort is \Theta(mLogm) for m input elements. For m = \Theta(Log n/(Log Log n)), the value of \Theta(m * Logm) will be \Theta( [Log n/(Log Log n)] * [Log (Log n/(Log Log n))] ) which will be \Theta( [Log n/(Log Log n)] * [ Log Log n - Log Log Log n] ) which is \Theta(Log n)


Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :