Question: Consider the online median problem: we are given a stream of integers ( for simplicity assume that they are all distinct ) . On reading

Consider the online median problem: we are given a stream of integers (for simplicity assume that they are all distinct). On reading the nth input integer, we are required to quickly output the median of all the n integers we have seen so far (the median of a set of n numbers when n is odd is uniquely defined; you may define what the median of a set of n integers {x1, x2,..., xn} is when n is even, but explicitly state the definition in your answer). Design and analyze an efficient algorithm that can compute the me. explain the algorithm as well.

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!