mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Fix bug in bucket_sort.py (#6005)
This commit is contained in:
parent
562cf31a9a
commit
bbb88bb5c2
|
@ -54,8 +54,8 @@ def bucket_sort(my_list: list) -> list:
|
|||
bucket_count = int(max_value - min_value) + 1
|
||||
buckets: list[list] = [[] for _ in range(bucket_count)]
|
||||
|
||||
for i in range(len(my_list)):
|
||||
buckets[(int(my_list[i] - min_value) // bucket_count)].append(my_list[i])
|
||||
for i in my_list:
|
||||
buckets[int(i - min_value)].append(i)
|
||||
|
||||
return [v for bucket in buckets for v in sorted(bucket)]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user