capacity = 4
Filled slot Empty capacity Just copied (resize)
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Dynamic Array — Amortized Resizing

Every general-purpose dynamic array — Java's ArrayList, C++'s std::vector, Python's list — hides the same trick: it over-allocates, and only pays the price of copying everything into a bigger block once in a while. This simulator renders the underlying memory block as a row of 3D cells in real capacity, lets you push and pop elements one at a time or in a burst, and animates the exact moment a resize happens — every existing element flashing amber as it's copied into the new, wider block. Live readouts track size, capacity, load factor, how many resizes and element-copies have happened in total, and the running average cost per push, which is the number that actually demonstrates the O(1) amortized bound: it climbs during a resize and then decays back down as more O(1) pushes dilute it, converging toward a small constant no matter how large the array grows.