public T RemoveMin() { if (IsEmpty) { throw new Exception("heap is empty."); } var min = Root.Element; Root = HeapNode <T> .Marge(Root.LeftChild, Root.RightChild); return(min); }
public void Insert(T element) { var node = new HeapNode <T>(element); Root = HeapNode <T> .Marge(Root, node); }
public void MargeWith(LeftHeap <T> other) { Root = HeapNode <T> .Marge(Root, other.Root); }