Closed TFloyd1989 closed 4 years ago
I actually took some time to understand it and I have a good grasp of it. Instead of the previous question, I now wonder what other sort we can use instead of bucketsort?
For MSD, you can use the bucketsort. I still feel it reasonable to track the beginIndex and endIndex.
For how to track, you can actually get the size of each bucket by using buckets.get(digit).size()
, then a recursive way would be fine
Thank you, however, what does digit represent? The digit of the bucket such as 0?
Is there also a way to find the total number of buckets?
Yes, digit represents 0-9.
Yes, there is a way because buckets
is just a list referring to line 31 here. Similarly, the way to get the number of buckets is the way of getting the length of the list. Does it sound reasonable?
I think this makes sense
Where does the 'key' in the lambda function in LSD sort come from?(key -> (key / div) % 10). I don't see it initialized anywhere, I was wondering how its value is determined?