Amortized cost
The average cost of an operation when spread over many: once in a while it costs a lot, but spread out it's little.
Example
Adding at the end of a dynamic list sometimes copies everything, but 1,000 additions cost about 2,300 steps: about 2 each.
Test yourself: Amortized cost
Dynamic lists
What does it mean for adding at the end to be amortized O(1)?
Adding 1,000 elements from capacity 10 and doubling, the copies add up to about 1,270: with the 1,000 additions that's about 2,300 steps, about 2 per addition.
0/1
â–¶ Play