Radix Sort vs Quick Sort
Same 220 values, same shuffle, same speed. Radix Sort finishes first and turns gold: 1,980 operations to 2,856.
The numbers
- Radix operations
- 1,980
- Quick operations
- 2,856
- Radix average
- n·k
- Quick average
- n log n
- Radix worst
- n·k
- Quick worst
- n²
Radix Sort
Radix Sort sorts numbers digit by digit, from the least significant digit up, without comparing values. More on Radix Sort.
Quick Sort
Quick Sort picks a pivot, splits the list into smaller and larger halves, and sorts each half the same way. More on Quick Sort.
FAQ
Which is faster, Radix Sort or Quick Sort?
On this shuffle of 220 values, Radix Sort needed 1,980 operations and Quick Sort needed 2,856, about 1.4× as many. On average Radix Sort is n·k and Quick Sort is n log n.
Which one is stable?
Radix Sort is stable; Quick Sort is not.
How is the race fair?
Both algorithms start from the same shuffle and run the same number of operations per frame. Every comparison, swap and write counts as one operation, so the one that needs fewer operations finishes first.