Why appending is amortized O(1)

Most appends just drop the value into a free slot — one cheap step. But when the array is full, it must allocate a doubled array and copy everything over, an expensive O(size) spike. Those spikes are rare enough to average out.

The array (capacity doubles when full)
size 0 / capacity 1
Cost of each append (tall bars = a resize + copy)
Appends
0
Total operations
0
Average per append
0 ops
cheap append (1 op) resize + copy (O(size))