DSA · Reimagined
Arrays easy time O(n) space O(1)

Insert into an Array

To insert at position p, every element from p onward slides one place right to open a slot — that shifting is why array insertion is O(n).

4
0
8
1
15
2
16
3
23
4

Insert 10 at index 2.

1 / 4

Practice

Machine twin: /dsa-viz-v2/array-insert.json — the full deterministic run as structured data.