Question: The following lab problem can be solved using priority queue efficiently. Problem: In this problem you want to read in a list of integer values.

The following lab problem can be solved using priority queue efficiently.
Problem:
In this problem you want to read in a list of integer values. After reading in each value
print the median of the list so far. There can be up to values.
What is Median?
Median can be defined as the element in the data set which separates the higher half of the
data sample from the lower half. When the input size is odd, we take the middle element of
sorted data as the median. If the input size is even, we pick an average of middle two
elements in the sorted stream as the median.
Sample Input/Output 1:
Input: 3//this number represents how many inputs
51015
Output:
5.0
7.5
10.0

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!