[Python] python实现bucket排序算法 →→→→→进入此内容的聊天室

来自 , 2020-09-11, 写在 Python, 查看 145 次.
URL http://www.code666.cn/view/be4e02ac
  1. def bucketSort(a, n, buckets, m):
  2.     for j in range(m):
  3.         buckets[j] = 0
  4.     for i in range(n):
  5.         buckets[a[i]] += 1
  6.     i = 0
  7.     for j in range(m):
  8.         for k in range(buckets[j]):
  9.             a[i] = j
  10.             i += 1
  11. #//python/8021

回复 "python实现bucket排序算法"

这儿你可以回复上面这条便签

captcha