跳转至内容

The Wikibooks community is developing a policy on the use of generative AI. Please review the draft policy and provide feedback on its talk page.

算法实现/排序/桶排序

从,开放世界下的开放书籍

Python

[编辑 | 编辑源代码]
def bucketSort(a, n, buckets, m):  
    for j in range(m):
        buckets[j] = 0
    for i in range(n):
        buckets[a[i]] += 1
    i = 0
    for j in range(m):
        for k in range(buckets[j]):
            a[i] = j
            i += 1
从 "https://wikibooks.cn/w/index.php?title=Algorithm_Implementation/Sorting/Bucket_sort&oldid=3677253" 找回
华夏公益教科书