The Potential Method
The potential method is the most powerful amortised analysis technique. It defines a potential function mapping each state of the data structure to a real number, representing “stored energy”. Changes in potential pay for work.
Definition
A potential function maps each possible data structure state to a real number, satisfying:
- for the initial (empty) state
- for all states
For an operation that transforms state to with actual cost , the amortised cost is:
Proof of Correctness
For a sequence of operations, starting from :
Since and , we have:
The total amortised cost bounds the total actual cost. This is the potential theorem.
Interpretation
- : the structure becomes “messier” (higher potential); the amortised cost exceeds the actual cost, “saving up” to pay for future cleanup
- : cleanup occurs, releasing potential to pay for the current operation
Think of as a measure of “disorder” in the data structure, or as a bank balance tracking stored credit.
Example: Binary Counter
Let .
- (counter starts at 0, no 1’s)
- always (count of bits cannot be negative)
Consider an INCREMENT where trailing 1’s flip to 0 and one 0 flips to 1. Actual cost: .
Change in potential:
- Before: ones
- After: ones (removed ones, added one)
Amortised cost:
Amortised per INCREMENT: .
This matches the accounting method result (charge 2 per increment). The potential method generalises the accounting intuition into a formal proof technique.
Choosing a Potential Function
Good potential functions often:
- Measure “disorder” that expensive operations will clean up (e.g. number of trees in a binomial heap root list, number of marked nodes in a Fibonacci heap)
- Increase smoothly with cheap operations and drop sharply during expensive cleanup
- Are non-negative and start at zero
For a dynamic array, works (see Dynamic Arrays Example).
For Fibonacci heaps, (see Binomial Heap Amortized Analysis).
Summary
| Aspect | Detail |
|---|---|
| Potential: “stored energy” in state | |
| Requirement | , |
| Total bound | |
| Key insight | rises during cheap ops, drops during expensive cleanup |
Past Tripos: y2024p1q9, y2023p2q7.