@@ -198,7 +198,9 @@ def binary_search(sorted_collection: list[int], item: int) -> int:
198198 -1
199199 """
200200 if any (a > b for a , b in pairwise (sorted_collection )):
201- raise ValueError ("Input list must be sorted in ascending order for binary search to work in ascending order" )
201+ raise ValueError (
202+ "Input list must be sorted in ascending order for binary search to work in ascending order"
203+ )
202204 left = 0
203205 right = len (sorted_collection ) - 1
204206
@@ -235,7 +237,9 @@ def binary_search_std_lib(sorted_collection: list[int], item: int) -> int:
235237 -1
236238 """
237239 if list (sorted_collection ) != sorted (sorted_collection ):
238- raise ValueError ("Input list must be sorted in ascending order for binary search to work" )
240+ raise ValueError (
241+ "Input list must be sorted in ascending order for binary search to work"
242+ )
239243 index = bisect .bisect_left (sorted_collection , item )
240244 if index != len (sorted_collection ) and sorted_collection [index ] == item :
241245 return index
@@ -269,7 +273,9 @@ def binary_search_with_duplicates(sorted_collection: list[int], item: int) -> li
269273 []
270274 """
271275 if list (sorted_collection ) != sorted (sorted_collection ):
272- raise ValueError ("Input list must be sorted in ascending order for binary search to work" )
276+ raise ValueError (
277+ "Input list must be sorted in ascending order for binary search to work"
278+ )
273279
274280 def lower_bound (sorted_collection : list [int ], item : int ) -> int :
275281 """
@@ -343,7 +349,9 @@ def binary_search_by_recursion(
343349 if right < 0 :
344350 right = len (sorted_collection ) - 1
345351 if list (sorted_collection ) != sorted (sorted_collection ):
346- raise ValueError ("Input list must be sorted in ascending order for binary search to work" )
352+ raise ValueError (
353+ "Input list must be sorted in ascending order for binary search to work"
354+ )
347355 if right < left :
348356 return - 1
349357
@@ -382,7 +390,9 @@ def exponential_search(sorted_collection: list[int], item: int) -> int:
382390 -1
383391 """
384392 if list (sorted_collection ) != sorted (sorted_collection ):
385- raise ValueError ("Input list must be sorted in ascending order for binary search to work" )
393+ raise ValueError (
394+ "Input list must be sorted in ascending order for binary search to work"
395+ )
386396 bound = 1
387397 while bound < len (sorted_collection ) and sorted_collection [bound ] < item :
388398 bound *= 2
0 commit comments