Bucketsort is a good sort when your input is unifomily distributed across the range. All of the elements have to be in range from 0.0 to 1.0.
The main idea of the algorithm is :
- Create n empty buckets
- Set all buckets to NULL.
- Insert the element into bucket array at the position n * array[idx].
- Sort individual buckets.
- Concatenate the sorted buckets.