Foundations — Bucket sort — uniform distributions
This page assumes nothing. If the parent note used a symbol, we build it here, from the picture up, in an order where each idea leans only on the ones before it.
1. A "list" (array) and its length
Picture a row of boxes side by side. If there are ten boxes, . That single number will appear everywhere: number of items, number of buckets, and the stretch factor when we compute an address.
Why the topic needs it. Bucket sort creates exactly buckets (one per expected element). So is doing double duty — it counts the input and sizes the workspace.

2. The half-open interval
Picture a ruler from 0 to 1. The left tip is a filled dot (included), the right tip is a hollow dot (excluded).
Why the topic needs it. Uniform inputs are stated to live in precisely so the address formula never overflows.

3. The floor function
Picture a staircase where each step is a whole number. Wherever stands on the ramp, floor drops it straight down to the step beneath its feet.
The two bent bars (like brackets missing their tops) are the floor symbol. In code this is int() for non-negative numbers.
Why the topic needs it. A bucket index must be a whole number (). The value is usually a decimal (e.g. ). Floor converts "somewhere in the range" into "which whole box" — it is the tool that turns a continuous value into a discrete address.
4. Subscripts: and
Picture each box in the row wearing a numbered sticker on its front. points at the value inside; counts how many values sit in bucket number .
Why the topic needs it. The proof sums over all buckets: . Without a name for "bucket 's load," we could not write that sum.
5. Putting it together: the address
Now every piece from §1–§4 combines into the single most important line of the whole topic.
WHAT this does, step by step (see figure):
- Stretch: multiply by . This blows the tiny ruler up to the wide ruler .
- Drop: floor the result. Every value in now maps to one of the whole numbers .
WHY multiply then floor and not something else? We want equal-width value slots to map to consecutive buckets. Multiplying by makes each slot of width become width ; flooring then reads off which unit-slot you're in. No comparisons, no searching — pure arithmetic. That is the "value-as-address" trick.

6. "Uniform distribution" — the assumption that makes it fast
Picture rain falling evenly across a flat roof: every tile catches about the same number of drops. Contrast with rain blown into one corner — that corner floods (a skewed distribution).
Why the topic needs it. Even rain → even bucket loads → each → each bucket trivially cheap to sort. This is the entire reason bucket sort beats . Break the assumption (all drops in one corner) and one bucket holds all items → the worst case.
Formally, "each item independently lands in bucket with probability " is the mathematical shape of "uniform." That statement is exactly what feeds the Binomial distribution used in the proof.

7. Big-O: , ,
Picture three curves climbing from the origin: a straight line (), a gently-bending sweep (), and a steep parabola (). Bucket sort aims for the straight line and falls to the parabola when the distribution assumption dies.
Why the topic needs it. The whole payoff is a claim about scaling: "expected ." You cannot state, prove, or appreciate that without this notation.
8. The sum symbol and expectation
Picture the sum as a conveyor belt tipping every bucket's cost into one running total; expectation as the flat line you'd draw through many noisy measurements.
Why the topic needs it. The proof computes . Both symbols are load-bearing: combines all buckets, averages away the randomness so we get one clean bound.
Prerequisite map
Equipment checklist
Cover the right side; can you answer before revealing?
What does stand for in bucket sort?
Is inside the interval ?
) excludes 1; only values up to but not reaching 1 are allowed.