Radix Sort
Counting-sort by each digit from least significant to most; stability makes it work.
Decision · step 10 of 33Counting and Radix Sort: Radix sort, ones then tens
in[6] = 25, ones digit 5. count[5] drops to 3, and that is its slot: out[3] = 25.
What you will see
One digit column is highlighted per pass; elements regroup by that digit.
Cost
| Best | O(d(n + b)) |
|---|---|
| Average | O(d(n + b)) |
| Worst | O(d(n + b)) |
| Space | O(n + b) |
d digitsbase b.
Properties
- × comparison based
- ✓ stable
- × in place
- × adaptive
- × online
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, compare two runs.
Screen readers: Cells announce index, value and state (comparing, swapped, sorted); each step announces the comparison outcome and any move.
Reduced motion: Swaps become value crossfades with outline flashes; sorted-region growth is a static span change.
Before this
Related
Variants
- LSD Radix Sort Least significant digit first.
- MSD Radix Sort Most significant digit first