Lingo

Insertion Sort Visualiser

Step through each insertion and watch the sorted prefix grow by one element.

Input

Grow a sorted prefix, shifting larger values right to open a gap.

24

Complexity

Operations for n elements.

  • Best O(n)
  • Average O(n²)
  • Worst O(n²)

Stable · In place

Array
24
5
8
23
6
2
17
21
20
13
15
12
19
7
14
11
10
18
1
22
4
3
16
9

The prefix left of the marker is already sorted.

1 / 210
0Comparisons
0Writes
1/210Steps
RunningResult

Insertion sort done.