DSA · Reimagined
Sorting easy time O(n²) space O(1)

Insertion Sort

Keep the left part sorted. Take the next value and slide it left past everything larger, until it sits in the right spot.

6
0
3
1
8
2
1
3
5
4
2
5

The first element is a sorted prefix of one. Extend it, one value at a time.

1 / 35

Practice

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