I have been asking thisproblem several times... could somebody at least give me
ID: 3617353 • Letter: I
Question
I have been asking thisproblem several times... could somebody at least give me anidea of how to solve this problem... I had it on a quiz and can'tfigure it out..A min-Heap can add items and extract the smallest itemat any given time. So what if instead we want to extract the medianvalue at any given time. Design a data structure that stores acollection of items and uses the next operations: 1.insert(x) to add x to collection of items; and 2.extract-median() to remove & return the item with median valuein the collection; both should run in O(log n) time ifthere are n items in the collection. I have been asking thisproblem several times... could somebody at least give me anidea of how to solve this problem... I had it on a quiz and can'tfigure it out..
A min-Heap can add items and extract the smallest itemat any given time. So what if instead we want to extract the medianvalue at any given time. Design a data structure that stores acollection of items and uses the next operations: 1.insert(x) to add x to collection of items; and 2.extract-median() to remove & return the item with median valuein the collection; both should run in O(log n) time ifthere are n items in the collection.
Explanation / Answer
Check your Private Message Section. I have send you a hint via private message to solve it.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.