mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 05:21:09 +00:00
Fix bugs and add related tests (#2375)
This commit is contained in:
parent
472f63eaa5
commit
80daa5750a
|
@ -7,11 +7,13 @@ def radix_sort(list_of_ints: List[int]) -> List[int]:
|
||||||
True
|
True
|
||||||
radix_sort(reversed(range(15))) == sorted(range(15))
|
radix_sort(reversed(range(15))) == sorted(range(15))
|
||||||
True
|
True
|
||||||
|
radix_sort([1,100,10,1000]) == sorted([1,100,10,1000])
|
||||||
|
True
|
||||||
"""
|
"""
|
||||||
RADIX = 10
|
RADIX = 10
|
||||||
placement = 1
|
placement = 1
|
||||||
max_digit = max(list_of_ints)
|
max_digit = max(list_of_ints)
|
||||||
while placement < max_digit:
|
while placement <= max_digit:
|
||||||
# declare and initialize empty buckets
|
# declare and initialize empty buckets
|
||||||
buckets = [list() for _ in range(RADIX)]
|
buckets = [list() for _ in range(RADIX)]
|
||||||
# split list_of_ints between the buckets
|
# split list_of_ints between the buckets
|
||||||
|
|
Loading…
Reference in New Issue
Block a user