Meaning and conditions
One array expansion can be expensive while an entire sequence remains linear. Compare actual append cost with potential change under capacity doubling.[1]
An append writes one element for one cost unit. At full capacity m, all n=m existing elements are first copied into an array of twice the capacity. That operation costs n+1. This model counts copies and the new write only, rather than actual memory-allocation time.[1]
Reasoning step by step
- Define state through size n and capacity m.
- Calculate actual copying and writing costs of the next append.
- Find the nonnegative potential before and after the operation.
- Add potential change to actual cost; potentials telescope over sequences.
Units, inverses and limits
Before the operation, integer 0≤n≤m and 1≤m≤240 are required. Full capacity doubles; otherwise m is unchanged, and n rises by one. The chosen potential is nonnegative and initially zero at n=0,m=1. Deletion and shrinking are outside this model.[1]
Two fully worked examples
Expand a full array
- Given
- Initially n=m=8.
- Find
- Find actual and amortized cost.
Count eight copies and one write.
Calculate new state and potentials.
Include potential change.
Result: Actual 9, amortized 3.
Check: The potential decrease of six covers six units of the costly copy operation.
A sequence of four appends
- Given
- Start n=m=4; four appends to n=8.
- Find
- Check total cost and telescoping.
Sum actual costs individually.
Use initial and final potentials.
Result: Four amortized costs of 3 total 12; actual sequence costs 8.
Check: 12+4−8=8 recovers actual cost; a nonempty start has initial potential.
Recall the method later with the formula’s flashcards.
10 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Seeing the relationship
Dynamic arrays: actual and amortized append cost
Free with a Quanta account. Your download stays ready after registration.
Five exercises with solutions
Calculate · Foundation
n=5, m=8: find actual and amortized cost.
Show hint
Use the stated definition and check its assumptions.
Learning goal: See how cheap steps build potential.
Rearrange · Application
ĉ=3, Φold=8 and Φnew=2: find c.
Show hint
Use the stated definition and check its assumptions.
Learning goal: Rearrange the potential identity.
Interpret · Application
Does amortized O(1) mean every append has constant cost?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Separate individual and sequence costs.
Show solution and calculation
No.
A full state costs n+1.
The constant bound describes distribution across an entire sequence.
Error analysis · Application
An analysis starts at n=m=4 but sets Φstart=0. What is missing?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Account correctly for the initial state.
Show solution and calculation
The chosen function gives Φstart=max(8−4,0)=4.
Telescoping must retain this initial potential.
Transfer · Challenge
Why does growing by exactly one slot instead of doubling give quadratic total copying?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Recognize growth strategy as an assumption.
Show solution and calculation
Almost every append then copies the entire previous content: 1+2+⋯+(N−1)=N(N−1)/2, which is Θ(N2).
Check your understanding with the formula’s reference test.
8 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Continue learning
Connect this calculation to Big-O notation and runtime recurrence.
Sources for this explanation
Quanta · Updated November 9, 2026
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Added a full article with original DE/EN examples, exercises, models and source checks.
Cite this reference page
Quanta. Amortized analysis of dynamic arrays. Updated November 9, 2026. https://quanta-study.de/en/formula-sheet/amortisierungsanalyse-dynamische-arrays
When citing a specific scientific statement, also cite the specialist source linked to that statement.