DS C4 Heaps
The time complexity is when normal heaps merge, which just neglects the original heap structure and simply builds a new heap.
Leftist Heaps
Definitions
Null path length
The null path length, NPL of any node : the length of the shortest path from to a node without two children.
Speacially, Define .
Leftist heap property
leftist heap property: For every node in the heap, the Npl
of the left child is at least as large as that of the right child. i.e
Right Path
The right
It follows that the right path ought to be short. Indeed, the right path down a leftist heap is as short as any in the
heap. Otherwise, there would be a path that goes through some, node X and takes the left child. Then X would violate the leftist property.
Lemma 1
A leftist tree with nodes on the right path must have at least nodes.
Skew Heaps
Binomial Queue
Structure Definition
A binomial queue is not a heap-ordered tree, but rather a collection of heap-ordered trees, known as a forest. Each heap-ordered tree is a binomial tree.
-
A binomial tree of height 0 is a one-node tree.
-
A binomial tree, , of height is formed by attaching a binomial tree , to the root of another binomial tree with smaller root element value .
Property
- consists of a root with children, which are .
- has exactly nodes.
- The number of nodes at depth is
Bk structure + heap order + one binomial tree for each height
A priority queue of any size can be uniquely represented by a
collection of binomial trees.
Operations
FindMin
Return the minimum key is in one of the roots.
There are at most roots, hence Tp = O( ).