Skip to content

Commit 2e31573

Browse files
committed
[mypy] Add/fix type annotations for bucket_sort(TheAlgorithms#4085)
1 parent 9752b04 commit 2e31573

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sorts/bucket_sort.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
2828
Source: https://en.wikipedia.org/wiki/Bucket_sort
2929
"""
30+
from typing import List
3031

3132

3233
def bucket_sort(my_list: list) -> list:
@@ -51,7 +52,7 @@ def bucket_sort(my_list: list) -> list:
5152
return []
5253
min_value, max_value = min(my_list), max(my_list)
5354
bucket_count = int(max_value - min_value) + 1
54-
buckets = [[] for _ in range(bucket_count)]
55+
buckets: List[list] = [[] for _ in range(bucket_count)]
5556

5657
for i in range(len(my_list)):
5758
buckets[(int(my_list[i] - min_value) // bucket_count)].append(my_list[i])

0 commit comments

Comments
 (0)