Algorithms | Sorting | Question 23

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



My Personal Notes arrow_drop_up