binomial heap.pptx for advanced data structure

akastiyan23 2 views 18 slides Mar 05, 2025
Slide 1
Slide 1 of 18
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18

About This Presentation

bfhdfhfdh


Slide Content

Binomial Heap

Binomial Heap 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. One such operation is the Union operation, which joins two heaps together. 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. Binomial heap presents the data structure, which supports Union operations more efficiently.

Binomial Trees 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. 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.

The Binomial Heap Properties A binomial heap is a collection of binomial trees that satisfies the following binomial-heap properties: No two binomial trees in the collection have the same size. Each node in each tree has a key. 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. The number of trees in a binomial heap is O(log n).

Implementation of a Binomial Heap A field key for its key A field degree for the number of children A pointer child , which points to the leftmost-child A pointer sibling, which points to the right-sibling A pointer p , which points to the parent

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

Operations on Binomial Heaps Creation of a new heap. Search for the minimum key. Uniting two binomial heaps. Insertion of a node. Removal of the root of a tree. Decreasing a key. Removal of a node.

Search for the Minimum Key To do this we find the smallest key among those stored at the roots connected to the head of H. What's the cost of minimum-search? 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.

Find Minimum Key

Insert New Node

Delete a Node

Unite Two Binomial Heaps

Binomial Heap Union Create heap H that is union of heaps H’ and H”. “Mergeable heaps” Easy if H’ and H” are each order k binomial trees Connect roots of H’ and H” Choose smaller key to be root of H Running Time O(log N)
Tags