public double getMedian() 
    {
        if ( leftHeap.size() == rightHeap.size() ) {
            return ( leftHeap.peekMax() + rightHeap.peekMin() ) / 2;
        }
        else if ( leftHeap.size() > rightHeap.size() ) {
            return leftHeap.peekMax();
        }
        else {
            return rightHeap.peekMin();
        }        
    }//O(1)