计数排序
计数排序
import random def count_sort(li, count=100): count = [0 for _ in range(count+1)] for val in li: count.append(val) li.clear() for ind, val in enumerate(count): for i in range(val): li.append(ind) li = [random.randint(0, 100) for _ in range(1000)] count_sort(li) print(li)