时间复杂度O(kn)
空间复杂度O(k+n)
def radix_sort(ls):
max_num=max(ls) #最大值
it=0
while 10**it<=max_num:
buckets=[[] foe _ in range(10)]
for val in ls:
ddigit=(val//10**it)%10
buckets[digit].append(val) #分桶完成
ls.clear()
for buc in buckets:
ls.extend(buc) #把数重新写回ls
it+=1