Radix Sort Visualizer

See Radix Sort process values by digit positions with animated buckets, playback controls, operation metrics, and clear explanations.

Current status: Distributing the highlighted value by its 1s digit.

Comma-separated numbers, up to 20 values.

Balanced

Live operation

bucket

Step 1 / 29
27
[0]
14
[1]
6
[2]
37
[3]
5
[4]
30
[5]
16
[6]
Current valueActive bucketCollection writeSorted

Digit buckets (base 10)

digit place: 1

0

1

2

3

4

5

6

7

27

8

9

Comparisons

0

Moves / writes

0

Confirmed sorted

0 / 7

Algorithm notes

What to watch for

LSD Radix Sort starts with the ones digit and works leftward. Stability is the key: a later digit pass preserves the order established by earlier digits.

Concept guide

Review the mental model, tradeoffs, and practical use cases after you experiment.

Radix Sort Complete Info Card

Non-ComparisonDigit-wise

Radix Sort is a digit-by-digit sorting algorithm that processes individual digits using a stable sort (typically Counting Sort). Efficient for numbers and fixed-length strings, it avoids direct element comparisons.

Algorithm Characteristics

Time Complexity (Best)

Fixed number of digits

O(nk)

Time Complexity (Average)

Uniform key distribution

O(nk)

Time Complexity (Worst)

All elements have same digit length

O(nk)

Space Complexity

Auxiliary counting sort needed

O(n + k)

Stable

Depends on base sort stability

Yes

In-Place

Requires additional memory

No

Sorting Process Steps

1

Find maximum number to determine digit count

2

Sort least significant digit (LSD) using stable sort

3

Move to next significant digit

4

Repeat until all digits processed

5

Final array is sorted

Variants & Methods

VariantAdvantagesChallenges
LSD (Least Significant)Simpler implementationProcesses all digits equally
MSD (Most Significant)Can stop earlyMore complex implementation
In-MemoryBetter cache usageLimited by memory
Fixed-Length KeysOptimal performanceRequires padding
Hybrid (MSD/LSD)Balanced approachImplementation complexity

Optimal Use Cases

  • Sorting large sets of integers
  • Fixed-length string sorting
  • When data has multiple digits/characters

When to Avoid

  • Floating-point numbers
  • Variable-length data with large variance
  • Small datasets with wide value ranges
Pro Tip: Radix Sort's performance depends heavily on the base chosen and the underlying stable sort (usually Counting Sort). Use base 256 for bytes or base 10 for human-readable numbers.
Digit-wiseLinear timeStable