Amortized cost 2026-10-18
In the potential method, an operation's amortized cost is . It can exceed or fall below its actual cost . The endpoint potentials determine how the total charge compares with the total actual cost.
Potential method 2026-10-18
The potential method assigns a number to each state of a data structure. Let be the state after operation , , and its actual cost. Its amortized cost is the actual cost plus the change in potential. Summing and cancelling adjacent potentials gives a telescoping sum:If and every reachable , the sum of amortized costs bounds the actual total for every prefix. A nonzero initial potential contributes the explicit additive term . Potential is proof bookkeeping; the algorithm need not store it.[ref]
Lecture 20: Hash tables and amortized analysis. CS 312 at Cornell University; CS 312, lecture 20, “Amortized analysis”: definition of amortized time and cancellation of successive potential changes
For dynamic array doubling, chooseThe potential method now starts at . After every nonempty reachable state, , so the maximum equals . There are just three cases for append:
For every , the total charge is , and the telescoping sum provesThis agrees exactly with . The unmodified choice has initial value , so calling it nonnegative at the empty state would be incorrect. It also works if that initial constant is retained in the identity; alternatively, starts at zero and is nonnegative on these reachable states. The maximum above keeps a literal nonnegative credit balance from the beginning. The proof covers append alone; allowing reserve or arbitrary deletion changes the reachable states and requires a new argument.
