AlgoScope

Bucket Sort

AlgorithmintermediateSorting

Scatter values into equal value ranges, sort each small bucket, gather in order: linear on even data.

Decision · step 2 of 19More Sorts: Bucket sort into four ranges
012345678in0-2425-4950-7475-99out427882361975305542✓

42 x 4 / 100 = 1, so 42 goes into bucket 25-49 as its first value.

Open in the player →or start at step 2

What you will see

Values fly into buckets by range; each bucket sorts; buckets concatenate.

How more sorts works →

Cost

BestO(n + k)
AverageO(n + k)
WorstO(n^2)
SpaceO(n + k)

Worst case when all values land in one bucket; stability depends on the inner sort.

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

Taught by the same lesson

More Sorts covers these too, in the same run.