Guided Lesson Notes
Understanding Insertion Sort
Insertion Sort focuses on ordering data so later operations become simpler, faster, or easier to prove correct. Insertion sort builds a sorted prefix by inserting each new value into its correct place.
Model: view the array as unsorted, partially sorted, and final regions; the algorithm is the rule for growing the final order.
Invariant: after each pass or recursive call, a known part of the data must be correctly ordered or correctly partitioned.
Implementation: comparisons, swaps, shifts, partitions, merges, counts, buckets, or digit passes depending on the algorithm.
Use Insertion Sort when the problem becomes easier after values are ordered, grouped, compared with neighbors, or processed by rank.
