Program to find the median of infinite stream of integer

Algorithm :

If count of total number is even then the number should be inserted into min Heap.
   else
The number should be inserted into max Heap.