public T pop() { T ret = top.val; top = HeapNode <T> .meld(top.r, top.l); return(ret); }
public void merge(Heap <T> h2) { top = HeapNode <T> .meld(top, h2.top); }
public void push(T val) { top = HeapNode <T> .meld(top, new HeapNode <T>(val)); }
public void merge(SkewHeap <T> otherHeap) { this.count_ += otherHeap.Count; this.topNode = HeapNode.meld(this.topNode, otherHeap.topNode); }
public void push(T val) { this.topNode = HeapNode.meld(this.topNode, new HeapNode(val)); this.count_++; }
public void pop() { this.topNode = HeapNode.meld(this.topNode.l, this.topNode.r); this.count_--; }