Bucket Sort Visualizer
Visualize Bucket Sort distributing values, sorting buckets, and gathering results with interactive playback and operation insights.
Comma-separated numbers, up to 20 values.
Live operation
distribute
Distribution buckets
bucket 0
bucket 1
bucket 2
Merged output
Comparisons
0
Moves / writes
0
Confirmed sorted
0 / 8
Algorithm notes
What to watch for
Bucket Sort works best when input values are spread fairly evenly across a known range. Good distribution keeps individual buckets small and cheap to sort.
Concept guide
Review the mental model, tradeoffs, and practical use cases after you experiment.
Bucket Sort Complete Info Card
Bucket Sort works by distributing elements into multiple buckets, sorting individual buckets (typically using another algorithm), then combining results. Ideal for uniformly distributed data like floating-point numbers.
Algorithm Characteristics
Time Complexity (Best)
Uniform element distribution
Time Complexity (Average)
Balanced bucket sizes
Time Complexity (Worst)
All elements in one bucket
Space Complexity
Bucket storage + sorting
Stable
Based on internal sort used
In-Place
Requires auxiliary buckets
Sorting Process Steps
Create empty buckets (array of lists)
Calculate bucket range from max value
Distribute elements into buckets
Sort individual buckets (e.g., Insertion Sort)
Concatenate sorted buckets
Key Features & Trade-offs
| Feature | Advantages | Considerations |
|---|---|---|
| Uniform Distribution | Optimal performance | Requires known data distribution |
| Bucket Count | More buckets = better performance | Memory trade-off |
| Hybrid Approach | Combines scatter-sort-gather | Multiple algorithms involved |
| Floating Points | Excellent for [0,1) range | Needs value normalization |
| Adaptive | Adjusts to data characteristics | Requires careful tuning |
Optimal Use Cases
- •Uniformly distributed floating-point numbers
- •When data characteristics are known
- •External sorting scenarios
When to Avoid
- •Non-uniform data distributions
- •Small datasets (overhead not justified)
- •Memory-constrained environments