Advanced Heaps and Amortized Analysis Workshop
Retrieval Prompts
- State the structural invariant of a binomial heap in terms of
n's binary representation. - State the amortized bounds of a Fibonacci heap for
insert,union,decrease-key, andextract-min. - State the potential function used in the Fibonacci-heap analysis.
- State the three amortized-analysis methods and one sentence on when each is most natural.
- Write the identity
amortized_i = actual_i + Delta Phi_iand name each term.
Compare and Distinguish
Separate these pairs clearly:
- binomial heap versus Fibonacci heap (what eager-vs-lazy means for each operation)
- Fibonacci heap versus pairing heap (proven bound vs practical performance)
- aggregate method versus potential method (which is more general and why)
- worst-case bound versus amortized bound (what each guarantees)
- average-case versus amortized (the difference between a probability distribution and a worst-case sequence)
Common Mistake Check
For each statement, identify the error:
- "
insertinto a binomial heap is alwaysO(1)because it just adds aB_0." - "Fibonacci heaps give Dijkstra an asymptotic improvement for every graph."
- "An amortized
O(1)operation is always fast; no single call can ever stall." - "Aggregate analysis is strictly weaker than potential analysis for every data structure."
- "The Fibonacci-heap marked bit exists to speed up
extract-min."
Mini Application
Part A - Heap trace
Starting from an empty binomial heap, insert 1, 3, 5, 7, 9, 11, 13, 15 one at a time. After each insert, record:
- the current value of
nin binary - the forest of binomial trees currently present (by order
B_k) - the number of tree-link operations performed
Verify that your running link count agrees with the amortized bound.
Part B - Fibonacci-heap derivation
Given the Fibonacci-heap potential
Phi = (number of roots t(H)) + 2 * (number of marked non-root nodes m(H)),
compute the amortized cost for each operation below:
insert(x)on a heap withtroots andmmarksunion(H1, H2)splicing root lists of sizest1, t2decrease-keythat cuts one node, with no cascade, from an unmarked parentdecrease-keythat cuts one node and triggers one cascading cut (parent was already marked)extract-minthat exposesdchildren and reduces the root count fromttoO(log n)after consolidation
State the result and the Delta Phi in each case.
Part C - Pick the heap
For each scenario, choose binary, binomial, Fibonacci, or pairing heap and justify:
- shortest-path computation on a sparse graph with
10^7edges - MST on a dense graph with
V^2edges whereV = 5,000 - a priority-queue-heavy simulation where
decrease-keydominates the operation mix - a code-golf competition where the simplest correct priority queue wins
Evidence Check
This page is complete only if you can:
- trace a full binomial-heap insert sequence by hand and predict the resulting forest
- apply the Fibonacci-heap potential function to compute amortized cost for at least two distinct operations
- decide between binary, binomial, Fibonacci, and pairing heaps for a stated operation mix
- explain in one sentence why amortized is not average-case