Skip to content
DSA Visualizerpreview

Dynamic array (doubling)

When the array is full, allocate twice the room and copy across; on average each push stays cheap.

O(1) amortised push; O(n) for the push that resizes time · O(n) space

Operations7, 3, 9, 4, 8, pop, 1, 6, 2

Start with room for one item.

Array of capacity 1 holding 0: nothing.
  • compare
  • swap or write
  • settled

1 / 24

Speed

Space play · ← → step · Home End jump · drag the strip to scrub