Pseudocode:
function bucketSort(array, n) is
buckets <- new array of n empty lists
for i=0 to (length(array)-1) do
insert array[i] into buckets[msbits(array[i], k)]
for i=0 to n-1 do
nextSort(buckets[i])
return the concatenation of buckets[0], ..., buckets[n-1]
Worst case performance: O(n2)
average case performance : O(n+k)