We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ec3f996 commit 486f356Copy full SHA for 486f356
bucket-sort/README.md
@@ -3,3 +3,14 @@
3
<div align="center">
4
<img src="https://github.com/iamlorddop/sorting-methods/blob/main/assets/img/bucket-sort.gif" alt="bucket-sort.gif">
5
</div>
6
+
7
+Bucket sort is mainly useful when input is uniformly distributed over a range. For example, consider the following problem.
8
+Sort a large set of floating point numbers which are in range from 0.0 to 1.0 and are uniformly distributed across the range.
9
10
+## How does Bucket Sort Work?
11
12
+bucketSort(arr[], n)
13
+- Create n empty buckets (or lists).
14
+- Do following for every array element arr[i]. Insert arr[i] into bucket[n * array[i]]
15
+- Sort individual buckets using insertion sort.
16
+- Concatenate all sorted buckets.
0 commit comments