Skip to content

Commit 36d9360

Browse files
Update bucket_sort.py
1 parent 45bf9e0 commit 36d9360

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sorts/bucket_sort.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ def bucket_sort(my_list: list, bucket_count: int = 10) -> list:
7777
return []
7878

7979
min_value, max_value = min(my_list), max(my_list)
80+
if min_value == max_value:
81+
return my_list
82+
8083
bucket_size = (max_value - min_value) / bucket_count
8184
buckets: list[list] = [[] for _ in range(bucket_count)]
8285

0 commit comments

Comments
 (0)