讨论/求职面试/桶排序Python 实现/

def bucketsort(nums):
max_ = max(nums)
buckets = [0] * (max + 1)
res []
for i in nums:
buckets[i] += 1
for j in range(len(buckets))
if buckets[j] != 0:
for k in range(buckets[j]):
res. append(j)
return res

1
共 0 个回复
暂无回复