Insertion Sort Game

Learn how insertion sort works by placing number cards in order. Move each card into the correct position while keeping the left side sorted. This interactive game helps students understand sorting algorithms step by step.

while
A[j]
>
temp
Rules
  • The left side is always sorted.
  • Only move the highlighted card.
  • Insert it into the correct position on the left.
  • If the left side becomes unsorted, the move is incorrect.
Pseudocode
temp = A[i]
j = i - 1

while j >= 0 and A[j] > temp:
    A[j + 1] = A[j]
    j--

A[j + 1] = temp