Question: Design a median-heap data structure. A median heap support two operations: insert(x), and extract- Median Extract-median should remove and return the median item from the

 Design a "median-heap" data structure. A median heap support two operations:

Design a "median-heap" data structure. A median heap support two operations: insert(x), and extract- Median Extract-median should remove and return the median item from the heap. If there are an even number of items, it should remove and return the upper median. Both insert and extract should run in O(log n) time, where n is the number of items currently in the heap

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!