Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void Insert(T element)
        {
            var node = new HeapNode <T>(element);

            Root = HeapNode <T> .Marge(Root, node);
        }
Exemplo n.º 3
0
 public void MargeWith(LeftHeap <T> other)
 {
     Root = HeapNode <T> .Marge(Root, other.Root);
 }