排序算法 互动版

桶排序算法伪代码

//桶排序
BUCKET_SORT(A)
    n = length[A]
    create buckets B[n]
    for i=1 to n
        insert A[i] to B[A[i]]
    for i=0 to n-1
        sort B[i] with INSERTION_SORT
     concatenate B[]
用桶排序算法对数组arr[10] = {8, 5, 10, 12, 7, 6, 15, 9, 11, 3}从小到大排序。