CSE 548: Analysis of Algorithms
Lectures 11, 12 & 13 ( Binomial Heaps )
Rezaul A. Chowdhury Department of Computer Science SUNY Stony Brook Fall 2012 Mergeable Heap Operations MAKE -HEAP ( ): return a new heap containing only element INSERT ( ): insert element into heap , MINIMUM ( ): return a pointer to an element in containing the smallest key
EXTRACT -MIN ( ): delete an element with the smallest key from and return a pointer to that element UNION ( ): return a new heap containing all elements of , heaps and , and destroy the input heaps More mergeable heap operations:
DECREASE -KEY ( ): change the key of element of heap to , , assuming the current key of DELETE ( ): delete element from heap , Mergeable Heap Operations
Heap Binary Heap Binomial Heap Operation ( worst-case ) ( amortized )
MAKE -HEAP Θ Θ 1 1 INSERT Ο Θ log 1 MINIMUM Θ Θ 1 1 EXTRACT -MIN Ο Ο log log UNION Θ Θ 1 DECREASE -KEY Ο log DELETE Ο log Binomial Trees
A binomial tree is an ordered tree defined recursively as follows. − consists of a single node − For , consists of two ’s that are linked together so that the 0 root of one is the left child of the root of the other Binomial Trees
Some useful properties of are as follows. 1. it has exactly nodes 2 2. its height is 3. there are exactly nodes at depth 0,1,2,…, 4. the root has degree 5. if the children of the root are numbered from left to right by , then child 1, 2,…,0 is the root of a Binomial Trees Prove: has exactly nodes at depth . 0,1,2,…, Proof: Suppose has nodes at depth . ,
0 0 , , 1 0, , , .