1 parent 472f63e commit 80daa57Copy full SHA for 80daa57
1 file changed
sorts/radix_sort.py
@@ -7,11 +7,13 @@ def radix_sort(list_of_ints: List[int]) -> List[int]:
7
True
8
radix_sort(reversed(range(15))) == sorted(range(15))
9
10
+ radix_sort([1,100,10,1000]) == sorted([1,100,10,1000])
11
+ True
12
"""
13
RADIX = 10
14
placement = 1
15
max_digit = max(list_of_ints)
- while placement < max_digit:
16
+ while placement <= max_digit:
17
# declare and initialize empty buckets
18
buckets = [list() for _ in range(RADIX)]
19
# split list_of_ints between the buckets
0 commit comments