Insertion Sort Visualization

Watch how insertion sort builds a sorted array by inserting each element into its correct position. This simple yet efficient algorithm is great for small datasets and nearly sorted arrays.

Speed:

How Insertion Sort Works:

  • Insertion sort builds a sorted array one element at a time
  • For each element, it finds the correct position in the already sorted portion
  • Elements are shifted to make room for the new element
  • Green bars represent sorted elements
  • Red bar is the element being inserted
  • Yellow bar is the element being compared