← Back

Insertion Sort

Build sorted prefix by inserting each element in place.

sortinginsertion-sortUpdated 2025-09-01

Complexity

  • Worst O(n^2)
  • Best O(n) nearly sorted

Stable

  • Preserves equal order