Insertion Sort builds the sorted array one item at a time. It picks each element and inserts it into its correct position among the already-sorted elements.
Think of sorting cards in your hand — you pick up each card and slide it into the right spot.
Time: O(n²) worst, O(n) best (nearly sorted data). Space: O(1). It's the best quadratic sort for small or nearly-sorted arrays.
insertion_sort([5, 2, 4, 6, 1, 3])
[1, 2, 3, 4, 5, 6]