There was an error while loading. Please reload this page.
1 parent eb06d0d commit 00fab97Copy full SHA for 00fab97
1 file changed
searches/exponential_search.py
@@ -85,6 +85,8 @@ def exponential_search(sorted_collection: list[int], item: int) -> int:
85
if list(sorted_collection) != sorted(sorted_collection):
86
raise ValueError("sorted_collection must be sorted in ascending order")
87
88
+ if not sorted_collection:
89
+ return -1
90
if sorted_collection[0] == item:
91
return 0
92
0 commit comments