Given a Integer stream, 1. find medium element (when sorted) and 2. insert element. Need to optimize for time.
Anónimo
Create two heap. One max and one min. Put half of the stuff on one heap and rest to the other. then if both heaps have same number of elements, return average of first element of both heaps, else return first element of heap with most elements.