Update counting_sort.py
之前代码有错误,第26行已修改
This commit is contained in:
parent
2280169fd9
commit
3e5fb58281
@ -23,7 +23,7 @@ def counting_sort(a: List[int]):
|
|||||||
a_sorted[index] = num
|
a_sorted[index] = num
|
||||||
counts[num] -= 1
|
counts[num] -= 1
|
||||||
|
|
||||||
a = a_sorted
|
a[:] = a_sorted
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@ -37,4 +37,4 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
a3 = [4, 5, 0, 9, 3, 3, 1, 9, 8, 7]
|
a3 = [4, 5, 0, 9, 3, 3, 1, 9, 8, 7]
|
||||||
counting_sort(a3)
|
counting_sort(a3)
|
||||||
print(a3)
|
print(a3)
|
||||||
|
Loading…
Reference in New Issue
Block a user