Hi everyone!, I had this confusion about the the Bucket Sort Algorithm.
I just wanna know why mostly bucket sort use the range of element in between 0 and 1 or [0,1).
[ .78, .23, .45, .95, .25 ,.19 and so on]
Just wondering why? :)
I think that some reference used the range [0, 1) so that the elements to be used are floating points.. To easily implement in code to find the buckets index to where the element is to be place. Unlike integers it assign each bucket a range.
Is my understanding right?
Re floating point elements. I think you are correct, but just like integers, you may need multiple buckets such as [0,1], [2,3], etc to cover the range of elements. I haven't used a bucket sort since the 1980's so my recollection is a bit misty at the moment. :-) Insertion sorts, binary tree sorts, etc. not such a problem. Anyway, if you have Knuth's volume 3, "Sorting and Searching", then the answers are there. When I have to go back to "the source", that's where I go. :-)