Learn
Practice
Newsletter
Resources
Mobile
New
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Insertion Sort
Bookmark
Input
Random Array
Reverse Sorted
Already Sorted
All Equal
Custom
arr
=
[31, 20, 59, 26, 41, 10]
0
1
2
3
4
5
31
20
59
26
41
10
0
1
2
3
4
5
31
20
59
26
41
10
pass =
1
key =
20
0
1
2
3
4
5
31
59
26
41
10
20
i
reached the front →
gap at index
0
pass =
2
key =
59
0
1
2
3
4
5
31
20
26
41
10
59
i
j
31
≤
59
→
gap at index
2
pass =
3
key =
26
0
1
2
3
4
5
31
20
59
41
10
26
i
j
move left: j =
1
pass =
3
key =
26
0
1
2
3
4
5
31
20
59
41
10
26
i
j
key
26
drops into index
1
pass =
4
key =
41
0
1
2
3
4
5
31
20
59
26
10
41
i
j
move left: j =
2
pass =
5
key =
10
0
1
2
3
4
5
31
20
59
26
41
10
i
j
lift key =
10
out of index
5
pass =
5
key =
10
0
1
2
3
4
5
31
20
59
26
41
10
i
j
31
>
10
?
pass =
5
key =
10
0
1
2
3
4
5
31
20
59
26
41
10
i
j
20
>
10
?
0
1
2
3
4
5
31
20
59
26
41
10
Array is sorted
algo
master
.
io
Step:
Start: sort the array in ascending order with insertion sort
0 / 56
Input
Random Array
Reverse Sorted
Already Sorted
All Equal
Custom
arr
=
[31, 20, 59, 26, 41, 10]
0 / 56
algo
master
.
io
Step:
Start: sort the array in ascending order with insertion sort