|All-time Popular Problems|
|Delete Middle of Linked List|
|Find all four sum numbers|
|Find first set bit|
|Element with left side smaller and right side greater|
|Smallest Positive missing number|
|Intersection Point in Y Shapped Linked Lists|
|Largest Number formed from an Array|
|Reverse an Array|
Given an input stream of n integers the task is to insert integers to stream and print the median of the new stream formed by each insertion of x to the stream.
Flow in stream : 5, 15, 1, 3 5 goes to stream --> median 5 (5) 15 goes to stream --> median 10 (5, 15) 1 goes to stream --> median 5 (5, 15, 1) 3 goes to stream --> median 4 (5, 15, 1, 3)
The first line of input contains an integer N denoting the no of elements of the stream. Then the next N lines contains integer x denoting the no to be inserted to the stream.
For each element added to the stream print the floor of the new median in a new line.