Sorting Lab

Algorithm visualizer

Insertion Sort

Builds a sorted prefix by inserting each new value where it belongs.

Complexity

Run

Step through the array

It behaves like sorting cards in your hand: shift larger cards aside and insert the key.

setup
9
4
7
2
8
1
6
3
5

Step 1 / 64: Treat the first value as a sorted prefix, then insert each next value into that prefix.

0%