2.
Binomial Heap<br />The binary heap data structure is fine for the simple operations of inserting, deleting and extracting elements, but other operations aren't so well supported.<br />One such operation is the Union operation, which joins two heaps together.<br />If the heaps are binary heaps then this requires building up a new heap from scratch, using the elements of the old heaps, which is expensive for large heaps.<br />Binomial heap presents the data structure, which supports Union operations more efficiently. <br />
3.
Binomial Trees<br />The binomial tree is the building block for the binomial heap. A binomial tree is an ordered tree that is, a tree where the children of each node are ordered.<br />Binomial trees are defined recursively, building up from single nodes. A single tree of degree k is constructed from two trees of degree k - 1 by making the root of one tree the leftmost child of the root of the other tree. <br />
4.
The Binomial Heap Properties<br />A binomial heap is a collection of binomial trees that satisfies the following binomial-heap properties:<br />1. No two binomial trees in the collection have the same size.<br />2. Each node in each tree has a key.<br />3. Each binomial tree in the collection is heap-ordered in the sense that each non-root has a key strictly less than the key of its parent.<br />The number of trees in a binomial heap is O(log n).<br />
6.
Implementation of a Binomial Heap<br />A field key for its key<br />A field degree for the number of children<br />A pointer child, which points to the leftmost-child<br />A pointer sibling, which points to the right-sibling<br />A pointer p, which points to the parent<br />
7.
The roots of the trees are connected so that the sizes of the connected trees are in decreasing order. Also, for a heap H, head [H] points to the head of the list<br />
8.
Operations on Binomial Heaps<br />Creation of a new heap.<br />Search for the minimum key.<br />Uniting two binomial heaps.<br />Insertion of a node.<br />Removal of the root of a tree.<br />Decreasing a key.<br />Removal of a node.<br />
9.
Search for the Minimum Key<br />To do this we find the smallest key among those stored at the roots connected to the head of H.<br />What's the cost of minimum-search?<br />The cost is O(log n) because there are O(log n) heaps, in each tree the minimum is located at the root, and the roots are linked.<br />
16.
Binomial Heap Union<br />Create heap H that is union of heaps H’ and H”.<br />“Mergeableheaps”<br />Easy if H’ and H” are each order k binomial trees<br /><ul><li>Connect roots of H’ and H”
17.
Choose smaller key to be root of H</li></ul>Running Time O(log N)<br />