🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Heaps & Priority Queues Quiz: all 8 questions

Heaps & Priority Queues Quiz · Question 6 of 8

Merging k sorted lists with N total nodes using a heap of list heads takes…

Merging k sorted lists with N total nodes using a heap of list heads takes…

  1. A.O(N·k)
  2. B.O(N log k)
  3. C.O(N log N)
  4. D.O(k)
Answer & explanation

Correct answer: O(N log k)

The heap never holds more than k nodes, and each of the N nodes is pushed and popped once.

Can you get the rest right without peeking?

Take the timed Heaps & Priority Queues Quiz quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →