Question: ( 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 one
byone 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
