Skip to content

Commit 993bb7a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 036698d commit 993bb7a

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

searches/binary_search.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ def binary_search(sorted_collection: list[int], item: int) -> int:
199199
"""
200200
if any(a > b for a, b in pairwise(sorted_collection)):
201201
raise ValueError(
202-
"Input list must be sorted in ascending order "
203-
"for binary search to work"
202+
"Input list must be sorted in ascending order for binary search to work"
204203
)
205204
left = 0
206205
right = len(sorted_collection) - 1
@@ -239,8 +238,7 @@ def binary_search_std_lib(sorted_collection: list[int], item: int) -> int:
239238
"""
240239
if list(sorted_collection) != sorted(sorted_collection):
241240
raise ValueError(
242-
"Input list must be sorted in ascending order "
243-
"for binary search to work"
241+
"Input list must be sorted in ascending order for binary search to work"
244242
)
245243
index = bisect.bisect_left(sorted_collection, item)
246244
if index != len(sorted_collection) and sorted_collection[index] == item:
@@ -276,8 +274,7 @@ def binary_search_with_duplicates(sorted_collection: list[int], item: int) -> li
276274
"""
277275
if list(sorted_collection) != sorted(sorted_collection):
278276
raise ValueError(
279-
"Input list must be sorted in ascending order "
280-
"for binary search to work"
277+
"Input list must be sorted in ascending order for binary search to work"
281278
)
282279

283280
def lower_bound(sorted_collection: list[int], item: int) -> int:
@@ -394,8 +391,7 @@ def exponential_search(sorted_collection: list[int], item: int) -> int:
394391
"""
395392
if list(sorted_collection) != sorted(sorted_collection):
396393
raise ValueError(
397-
"Input list must be sorted in ascending order "
398-
"for binary search to work"
394+
"Input list must be sorted in ascending order for binary search to work"
399395
)
400396

401397
bound = 1

0 commit comments

Comments
 (0)