Skip to content

Commit bbb88bb

Browse files
authored
Fix bug in bucket_sort.py (#6005)
1 parent 562cf31 commit bbb88bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sorts/bucket_sort.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def bucket_sort(my_list: list) -> list:
5454
bucket_count = int(max_value - min_value) + 1
5555
buckets: list[list] = [[] for _ in range(bucket_count)]
5656

57-
for i in range(len(my_list)):
58-
buckets[(int(my_list[i] - min_value) // bucket_count)].append(my_list[i])
57+
for i in my_list:
58+
buckets[int(i - min_value)].append(i)
5959

6060
return [v for bucket in buckets for v in sorted(bucket)]
6161

0 commit comments

Comments
 (0)