Algorithms
Algorithms copied to clipboard
Bucket sort bug fix
trafficstars
In the current implementation all elements will be placed into bucket 0 (ar[i] - minValue is always less than M, which is maxValue - minValue + 1, so ar[i] - minValue) / M must be 0) (see commit https://github.com/williamfiset/Algorithms/commit/be4b0a9533de73461261e9aa6aca35b9e0c50f41 )
To place into different buckets the bucket index should be calculated as numBuckets * (ar[i] - minValue) / M