We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 562cf31 commit bbb88bbCopy full SHA for bbb88bb
sorts/bucket_sort.py
@@ -54,8 +54,8 @@ def bucket_sort(my_list: list) -> list:
54
bucket_count = int(max_value - min_value) + 1
55
buckets: list[list] = [[] for _ in range(bucket_count)]
56
57
- for i in range(len(my_list)):
58
- 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)
59
60
return [v for bucket in buckets for v in sorted(bucket)]
61
0 commit comments