This commit is contained in:
krahets
2025-03-14 17:51:03 +08:00
parent c458348df2
commit e81bc45c43
31 changed files with 392 additions and 394 deletions
+1 -3
View File
@@ -27,9 +27,7 @@ comments: true
"""计数排序"""
# 简单实现,无法用于排序对象
# 1. 统计数组最大元素 m
m = 0
for num in nums:
m = max(m, num)
m = max(nums)
# 2. 统计各数字的出现次数
# counter[num] 代表 num 的出现次数
counter = [0] * (m + 1)