diff --git a/searches/binary_search.py b/searches/binary_search.py index 2e66b672d5b4..a88b6603d9be 100644 --- a/searches/binary_search.py +++ b/searches/binary_search.py @@ -45,7 +45,7 @@ def bisect_left( 2 """ if hi < 0: - hi = len(sorted_collection) + hi = len(sorted_collection) + hi # in case of usage of negative indexing for hi while lo < hi: mid = lo + (hi - lo) // 2 @@ -86,7 +86,7 @@ def bisect_right( 2 """ if hi < 0: - hi = len(sorted_collection) + hi = len(sorted_collection) + hi # in case of usage of negative indexing for hi while lo < hi: mid = lo + (hi - lo) // 2