Bucket Sort for Uniform Samples

Coding · Medium · Free problem
You have $n$ i.i.d. samples drawn from $\text{Unif}[0, 1)$. Design a bucket sort algorithm to sort them. 1. Write pseudocode for the algorithm. 2. Prove that the expected running time is $O(n)$ and that it uses $O(n)$ extra space. 3. What happens when the input distribution is not uniform -- for example, heavily skewed or heavy-tailed? How does performance degrade, and what could you do about it?

Open the full interactive solver, hints, and worked solution →