Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 + 1 # in case of negetive indexing used 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 + 1 # in case of negetive indexing used for hi

while lo < hi:
mid = lo + (hi - lo) // 2
Expand Down