Interactive insertion sort. Each value is lifted out and slid into its place in the sorted left side.
Array · n=8
unsorted
key (lifted)
compare
shift
sorted prefix
Step 0 / 0
Press Play. Lift each value, slide larger ones right, drop it into its slot.
Speed
for i in 1 … n-1
key = a[i]
j = i - 1
while j ≥ 0 and a[j] > key
a[j+1] = a[j]
j -= 1
a[j+1] = key
timeline0 / 0
←→space walk steps