1. Structure
- a collection of min-heap-ordered trees.
- not constrained to be binomial trees.
- trees with Fibonacci heaps are rooted but unordered.(rootlist is not ordered)
Representation of Fibonacci Heaps
- p[x] to its parent
- child[x] to any one of its children(only point to one children)
- left[x] to left sibling(circular, doubly linked lists)
- right[x] to right sibling (circular, doubly linked lists)
- degree[x] the number of children in the child list of node x
- mark[x] indicates whether node x has lost a child since the last time x was made the child of another node.
- min[H] minimum node
Advantage of doubly linked lists:
- remove a node from a circular, doubly linked list in O(1) time
- concatenate two such lists into one circular, doubly linked list in O(1) time.
Potential function P(H)=count(root) + 2* count(marked)
2. Mergeable-heap operations
*Do not need to consolidate the trees within the Fibonacci heap except extract min. Delay work as late as possible
- make-heap
- insert: make a new node and add it to rootlist
- minimum
- union: concatenate the root list of two heap and then change minimum if necessary
- extract-min: remove min, add its children to root list, merge same degree trees??why need to consolidate
- decrease key: if decreased is bigger than its parent, complete. else add this subtree to root list, unmark this node. If its original parent is unmarked, mark it. else cut it add to root list, recursively does this to the ancestor on the path to the root.(If an marked node added to root list, it is unmarked) If the parent is already in root list, no need to mark. ??amortized cost
- delete: decrease key to smallest, extract-min