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 priority queue of any size can be uniquely represented by a collection of binomial trees.
Example
Operations¶
-
Findmin:
The minimum key is in one of the roots. There are at most \(\lceil log_2N \rceil\) roots, hence the time complexity is \(O(logN)\).(Can be stored and updated in constant time)
-
Merge:
Must keep the trees in the binomial queue sorted by height. \(T_p=O(logN)\)
-
Insert:
If the smallest nonexistent binomial tree is Bi , then \(T_p=Const·(i+1)\). Performing N Inserts on an initially empty binomial queue will take O(N) worst-case time. Hence the average time is constant.
-
DeleteMin:
illustration
Implementation¶
Proof¶
- Claim: A binomial queue of N elements can be built by N successive insertions in O(N) time.
Proof