[
next
] [
prev
] [
prev-tail
] [
tail
] [
up
]
Bucket sort
For each item, the value range is limited, and is integer. For example, sort all students score. (0<=score<=100).
Basic step: Here, Link list is best option to implement a bucket. Because Nobody will now how many elements will be put into the each bucket.
Set up an array of initially empty "buckets".
Scatter: Go over the original array, putting each object in its bucket.
Sort each non-empty bucket.(Optional )
Gather: Visit the buckets in order and put all elements back into the original array.
[
next
] [
prev
] [
prev-tail
] [
front
] [
up
]