public void addNum(int num) {
        if (maxPq.size() == 0) {
            maxPq.add(num);
            return;
        }
        if (maxPq.size() == minPq.size()) {
            if (minPq.peek() < num) {
                maxPq.offer(minPq.poll());
                minPq.offer(num);
            } else {
                maxPq.offer(num);
            }
        } else {
            int toBeOffered = 0;
            if (num >= maxPq.peek()) {
                toBeOffered = num;
            } else {
                toBeOffered = maxPq.poll();
                maxPq.offer(num);
            }
            minPq.offer(toBeOffered);
        }
    }
Date 03/03/2016
@author Tushar Roy

Find median in stream of numbers

https://leetcode.com/problems/find-median-from-data-stream/
src/com/interview/stackqueue/MedianFinder.java