Skip to content

Commit c9679e3

Browse files
adding the comment about negative indexing for hi
1 parent e109908 commit c9679e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

searches/binary_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def bisect_left(
4545
2
4646
"""
4747
if hi < 0:
48-
hi = len(sorted_collection)-hi
48+
hi = len(sorted_collection)-hi #in case of usage of negative indexing for hi
4949

5050
while lo < hi:
5151
mid = lo + (hi - lo) // 2
@@ -86,7 +86,7 @@ def bisect_right(
8686
2
8787
"""
8888
if hi < 0:
89-
hi = len(sorted_collection)-hi
89+
hi = len(sorted_collection)-hi #in case of usage of negative indexing for hi
9090

9191
while lo < hi:
9292
mid = lo + (hi - lo) // 2

0 commit comments

Comments
 (0)