Dynamic array and amortised growth

easy

Most pushes write one slot; occasionally one reallocates and copies everything. Because the expensive pushes get rarer exactly as fast as they get more expensive, the average stays constant. Set the growth factor to +1 to see it break.

Average O(1) amortisedWorst O(n)Space O(n)
Loading the dynamic array and amortised growth engine…

Where to go next