Skip to content
Closed
4 changes: 2 additions & 2 deletions searches/binary_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading