Skip to content
Medium-Easy Understand Heaps & Priority Queues Multiple Choice

What is the time and space complexity of the two-heap MedianFinder?

Understand — Tests comprehension and ability to explain concepts.

Answer Options

A O(1) addNum, O(1) findMedian, O(n) space
B O(log n) addNum, O(1) findMedian, O(n) space
C O(n) addNum, O(1) findMedian, O(1) space
D O(log n) addNum, O(log n) findMedian, O(1) space

Want to see the correct answer?

Get the answer with a detailed explanation, plus practice 31+ more Heaps & Priority Queues questions with adaptive quizzes and timed interviews.

See the Answer on Guru Sishya →

This question is from the Heaps & Priority Queues topic (Data Structures).

More Heaps & Priority Queues Questions