# Sorting Algorithm Stepper

> Paste a small list of numbers, pick a strategy - bubble, selection, insertion, merge, or quick - and watch the algorithm think: every comparison, every swap, one WHY line per move, with live comparison and write counters that make Big-O growth tangible.

- Tool: https://ronutz.com/en/tools/sorting-algorithm-stepper
- Family: Web & HTTP

---

The stepper takes a list of 2-16 numbers and executes your chosen strategy one visible decision at a time. Each step shows the array state with the touched indices highlighted, the step kind (compare, swap, write, note), and a one-line reason for the move - the invariant the algorithm is protecting. The counters at the bottom are the point: re-run the same list across strategies, or grow the list, and watch how comparisons and writes scale. That scaling curve is Big-O made concrete, as [the algorithms primer](https://ronutz.com/en/learn/what-is-an-algorithm) develops.

Two teaching behaviors are deliberately preserved. Bubble sort carries the classic early-exit: feed it an already-sorted list and it detects the clean pass and stops after one linear sweep. Quicksort uses the common teaching form - Lomuto partition with the last element as pivot - which means an already-sorted list drives it toward its O(n²) worst case; paste one and watch the counters explode. Everything runs locally, the output is invariant-checked for sortedness on every run, and the same engine is callable through the site's API with a JSON body of `{"text": "5 3 8 1", "strategy": "merge"}`.

## Standards and references

- [Textbook-canonical algorithm variants (bubble with early-exit, selection, insertion, top-down merge sort, Lomuto-partition quicksort with last-element pivot) as taught across standard curricula; no vendor specification exists or is claimed - correctness is enforced by the golden vectors and a per-run output-sortedness invariant](https://en.wikipedia.org/wiki/Sorting_algorithm) - strategy definitions and canonical behaviors

## Related reading

- [What Is an Algorithm? A Working Primer](https://ronutz.com/en/learn/what-is-an-algorithm.md): An algorithm is a finite, unambiguous recipe that turns input into output - and the engineering questions are always the same three: is it correct, how does its cost grow, and what does it trade away. Big-O as the grammar of growth, why constants and asymptotes both matter, the core families you already operate (search, sort, hash, graph, state machines), and where each one is already running inside this site's own tools.
