Radix Sort is a non-comparative sorting algorithm that sorts integers digit-by-digit from least significant digit (LSD) to most significant digit (MSD) using counting sort buckets.
Group numbers into digit buckets [0..9] based on the least significant digit (1s place).
1s Digits: [170, 90], [802, 2], [24], [45, 75], [66] -> Output: [170, 90, 802, 2, 24, 45, 75, 66]Group numbers into digit buckets [0..9] based on the 10s digit place.
10s Digits: [802, 2], [24], [45], [66], [170, 75], [90] -> Output: [802, 2, 24, 45, 66, 170, 75, 90]Group numbers into digit buckets [0..9] based on the 100s digit place.
100s Digits: [2, 24, 45, 66, 75, 90], [170], [802] -> Sorted: [2, 24, 45, 66, 75, 90, 170, 802]Sort mail by day first (01-31), then sort by month (01-12), then sort by year. The final stack will be completely ordered by date.
500 steps (Linear)
O(N) Linear Time
O(N) Memory
Memory growth rate as N expands.
Relative efficiency rating for large N.
| Operation | Time Complexity | Space Complexity |
|---|---|---|
| Time Complexity | O(d × (N + k)) | O(N + k) |
function radixSort(arr) {
const maxNum = Math.max(...arr);
let exp = 1;
while (Math.floor(maxNum / exp) > 0) {
countingSortByDigit(arr, exp);
exp *= 10;
}
return arr;
}Fast sorting of 32-bit/64-bit integer keys in GPU memory.
Validate your conceptual understanding, operation mechanics, and core concepts of Radix Sort.
Radix Sort breaks the O(N log N) comparison lower bound because it uses digit index buckets instead of direct element comparisons!
Array loaded. Trigger Radix Sort to distribute elements into digit buckets (0-9).