Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 3 0 pts . ) Median Heaps. Consider an array of N numbers x 1 , x 2 , dots, x N that you
pts Median Heaps. Consider an array of numbers dots, that you will be receiving onebyone in a single pass ie as a stream of numbers You are not allowed to requery previous numbers. Design an effective data structure involving one or more heaps that, after receiving the nth number, reports the median of the numbers dots, observed so far. The time complexity of your algorithm should be per number received in the worst case. For simplicity, assume there are no duplicates in the stream. Explain the algorithmdata structure, running time, and correctness.
Hint: If is odd, the median of the data stream dots, is the middle element of the sorted data stream, else the median is the average of the middle two elements of the sorted data stream.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started