Intuition The one core idea
A dynamic array or hash table sometimes does a slow "grow the box" step, but if you double the box each time, those slow steps are so rare that the average work per operation stays constant. This whole topic is just the arithmetic that proves "occasionally slow + rare enough = constant on average."
Before you can read the parent note 3.3.7 Amortized O(1) , you need to earn every symbol it throws at you. Below, each idea is built from nothing, shown as a picture, and justified by the question it answers. Read top to bottom — each block uses only what came before it.
Definition Cost of an operation
A cost is simply how many basic steps an operation takes — one "step" = writing one number into one slot, or copying one number from an old box to a new box.
We do not measure seconds; we count steps , because steps don't change when you buy a faster computer.
Think of a row of little boxes (slots). Writing a toy into one box = 1 step . Moving a toy from an old row to a new row = 1 step . That's all "cost" ever means here.
Why the topic needs it. Everything later ("O ( n ) ", "amortized 3") is just adding up these steps . If you can't count steps, none of the sums make sense.
Definition size and capacity
capacity = how many slots the box has (empty or full).
size = how many slots are currently filled .
A box is full when size = capacity .
Imagine an egg carton. capacity = number of egg-holes in the carton. size = number of eggs actually sitting in it. When every hole has an egg (size = capacity), you can't add another egg without a bigger carton.
Why the topic needs it. A resize is triggered exactly when size would exceed capacity. Every formula in the parent — the potential Φ = 2 ⋅ size − capacity , the load factor — is built from these two numbers.
Definition push and resize
A push adds one new item into the next empty slot. Normal cost: 1 step .
A resize happens when the box is full: allocate a bigger box, copy every existing item over, then push the new one. Cost: (number of items copied) + 1.
Pushing = dropping one egg into an empty hole (fast). Resizing = the carton is full, so you buy a new, bigger carton, move every egg across one at a time , then add the new egg (slow).
Why the topic needs it. The entire question of the topic is: resizes are slow — how slow are they on average? You must know a resize copies all current items before you can count that cost.
2 k means "multiply 2 by itself k times." The little raised number k is the exponent — it counts how many times we doubled .
2 0 = 1 , 2 1 = 2 , 2 2 = 4 , 2 3 = 8 , …
Intuition Why this notation?
When we double the box each time, the capacities we pass through are 1 , 2 , 4 , 8 , … — exactly the powers of two. Writing 2 k is just a compact name for "the capacity after k doublings." The letter k (and later m ) is an index — a counter, not a real quantity.
Why the topic needs it. The parent writes "resizes happen at sizes 1 , 2 , 4 , … , 2 m ." Without powers of two, that list has no name and no formula.
∑ is just a machine that says "do this for every counter value and total it." It saves you from writing "1 + 2 + 4 + … " by hand.
Why the topic needs it. The total copy cost of all resizes is written as one ∑ . You can't read the derivation without decoding this symbol.
Intuition The picture that makes it obvious
Stack blocks of width 1 , 2 , 4 , 8 . Each new block is as wide as everything before it plus one . So the whole stack never grows past twice the last block . That is the heart of the whole topic: all the past copying together is less than twice the most recent copy.
Why the topic needs it — and why THIS tool. We use a geometric series (each term multiplied by a fixed factor 2) instead of an arithmetic series (each term plus a fixed amount) because geometric sums stay linear (< 2 n ) while arithmetic sums blow up to quadratic (n 2 /2 ). This single choice is the difference between O ( 1 ) and O ( n ) amortized. See Geometric Series .
==n == = the number of operations (e.g. how many pushes we do). It's the "how big is the job" knob.
==O ( f ( n )) == = a promise about how the cost grows as n grows , ignoring constant multipliers.
O ( 1 ) = cost doesn't grow with n (constant).
O ( n ) = cost grows in proportion to n (linear).
O ( n 2 ) = cost grows like n squared (quadratic — very bad).
Plot cost against n . A flat line is O ( 1 ) . A straight slope is O ( n ) . A curve that bends sharply upward is O ( n 2 ) . Big-O just asks: which shape? — not the exact height.
Why the topic needs it. The punchline "amortized O ( 1 ) " and the warning "additive growth is O ( n 2 ) " are both statements about these shapes. See Big-O Notation .
Load factor α = capacity size — the fraction of slots that are filled.
If α = 0.5 , the table is half full. When α climbs past a chosen threshold, the hash table does a rehash (its version of a resize).
Same egg carton, but now expressed as a percentage full . α = 0.5 means "half the holes have eggs." A hash table deliberately keeps itself not too full so lookups stay fast — see Load Factor .
Why the topic needs it. Example 2 in the parent triggers resizing off α instead of "box is full," but the cost math is identical.
Definition Amortized cost
The amortized cost of one operation = (total cost of n operations) ÷ n . It's the fair share each operation owes, even if some ops secretly did more work.
Φ
==Φ == (Greek letter "phi") is a savings account of pre-paid work . Cheap operations deposit into it; the expensive resize withdraws from it. Defined so it never goes negative.
amortized cost = actual cost + ΔΦ
where ==ΔΦ == ("delta phi") = the change in the account, (after) − (before).
Every cheap push puts a couple of coins in a jar sitting next to the array. When a resize demands lots of work, you smash the jar and the saved coins pay for it — so the resize looks cheap in the averaged books. See Potential Method and Stack with Multipop for another example of the same trick.
Why the topic needs it. The parent's formal proof uses Φ = 2 ⋅ size − capacity . Without knowing Φ is "saved work" and ΔΦ is "its change," those lines are unreadable.
Geometric series stays linear
Amortized cost = total over n
Potential Phi savings jar
Test yourself — cover the right side.
I can say what a "cost" of 1 step physically means One write of a number into a slot, or one copy of a number to a new box; we count steps, not seconds.
I can define size vs capacity capacity = total slots the box has; size = slots currently filled; full means size = capacity.
I know what a push costs normally and during a resize Normal push = 1 step; resize = copy all current items + 1 write.
I can read 2 k and list the first few powers of two 2 0 = 1 , 2 1 = 2 , 2 2 = 4 , 2 3 = 8 ; the exponent counts how many times we doubled.
I can expand ∑ i = 0 m 2 i into a plain sum 2 0 + 2 1 + ⋯ + 2 m — add 2 i for every counter value from 0 to m.
I know the geometric-series shortcut 1 + 2 + 4 + ⋯ + 2 m = 2 m + 1 − 1 , which is less than twice the last term.
I can tell O ( 1 ) , O ( n ) , O ( n 2 ) apart by shape Flat line, straight slope, upward-bending curve — respectively.
I can compute load factor from size and capacity α = size / capacity , the fraction of slots filled.
I know what amortized cost is Total cost of n operations divided by n — the fair share each op owes.
I know what Φ and ΔΦ represent Φ = a savings account of pre-paid work; ΔΦ = its change (after − before).
Amortized O(1) operations — the parent topic these foundations unlock.
Dynamic Arrays — where size/capacity/resize live.
Hash Tables — same resize math via rehashing.
Load Factor — the α dial that triggers rehash.
Geometric Series — the 1 + 2 + 4 + ⋯ < 2 n fact.
Big-O Notation — the growth shapes.
Potential Method — the Φ savings-jar formalism.
Stack with Multipop — another amortized example using the same jar idea.