## Bucket sort

- Assumption: input is n reals from [0, 1)
- Basic idea:
- Create n linked lists (buckets) to divide interval [0,1) into subintervals of size 1/n
- Add each input element to appropriate bucket and sort buckets with insertion sort

- Uniform input distribution ? O(1) bucket size
- Therefore the expected total time is O(n)

- These ideas will return when we study hash tables

Previous slide | Next slide | Back to first slide | View graphic version |