mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 21:24:53 +08:00
Bug fixes and improvements (#1732)
* Bug fixes * Sync zh and zh-hant versions. * "入列列" -> "入佇列" * Fix hello_algo_mindmap.png
This commit is contained in:
@ -9,9 +9,7 @@ def counting_sort_naive(nums: list[int]):
|
||||
"""計數排序"""
|
||||
# 簡單實現,無法用於排序物件
|
||||
# 1. 統計陣列最大元素 m
|
||||
m = 0
|
||||
for num in nums:
|
||||
m = max(m, num)
|
||||
m = max(nums)
|
||||
# 2. 統計各數字的出現次數
|
||||
# counter[num] 代表 num 的出現次數
|
||||
counter = [0] * (m + 1)
|
||||
|
||||
Reference in New Issue
Block a user