Guided Lesson Notes
Understanding Bubble Sort
Bubble Sort focuses on ordering data so later operations become simpler, faster, or easier to prove correct. Bubble sort repeatedly swaps adjacent out-of-order items, making it simple to trace but inefficient for large inputs.
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 Bubble Sort when the problem becomes easier after values are ordered, grouped, compared with neighbors, or processed by rank.
