Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2005 | Question 39

  • Last Updated : 19 Feb, 2021

Suppose there are ⌈ log n ⌉ sorted lists of ⌊ n/log n ⌋ elements each. The time complexity of producing a sorted list of all these elements is :
(Hint : Use a heap data structure)
(A) O(n log log n)
(B) θ(n log n)
(C) Ω(n log n)
(D) Ω(n3/2)


Answer: (A)

Explanation: We can merge x arrays of each size y in in O(xy*Logy) time using Min Heap.

x = Logn
y = n/Logn

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

We get O(n/Logn * Logn * Log Log n) which is O(nLogLogn)

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :