Given an unsorted sequence of integers that flows into your program as a stream.
The integers are too many to fit into memory.
Imagine there is a function:
int getNext() throws NoSuchElementException;
It returns the next integer from the stream.
Write a function to find the median.
Solve the problem in O(n).
Any ideas?
Hint is given (use heap the data structure..)