next up previous
Next: Up: Previous:

Mergeable Heaps

Union(H1, H2)
Creates and returns a new heap containing all nodes from heaps H1 and H2



Binary Heaps:
Union = $\Theta(n)$ worst case
Binomial Heaps:
Union = $O(\lg n)$ worst case
Fibonacci Heaps:
Union = $\Theta(1)$ amortized



Other operations:

  Binary Heap Binomial Heap Fibonacci Heap
  (worst case) (worst case) (amortized)
Make-Heap $\Theta(1)$ $\Theta(1)$ $\Theta(1)$
Minimum $\Theta(1)$ $\Theta(lgn)$ $\Theta(1)$
Extract-Min $\Theta(lgn)$ $\Theta(lgn)$ $\Theta(lgn)$
(Union) $\Theta(n)$ $\Theta(lgn)$ $\Theta(1)$
Decrease-Key $\Theta(lgn)$ $\Theta(lgn)$ $\Theta(1)$
Delete $\Theta(lgn)$ $\Theta(lgn)$ $\Theta(lgn)$
Insert $\Theta(lgn)$ $\Theta(lgn)$ $\Theta(1)$



Extract-Min maintains partial ordering over keys.

This is useful for many graph algorithms.


next up previous
Next: Up: Previous: