mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
parent
fe5c711ce6
commit
ce9a139b56
@ -51,7 +51,7 @@ def bisect_left(
|
||||
hi = len(sorted_collection)
|
||||
|
||||
while lo < hi:
|
||||
mid = (lo + hi) // 2
|
||||
mid = lo + (hi - lo) // 2
|
||||
if sorted_collection[mid] < item:
|
||||
lo = mid + 1
|
||||
else:
|
||||
@ -96,7 +96,7 @@ def bisect_right(
|
||||
hi = len(sorted_collection)
|
||||
|
||||
while lo < hi:
|
||||
mid = (lo + hi) // 2
|
||||
mid = lo + (hi - lo) // 2
|
||||
if sorted_collection[mid] <= item:
|
||||
lo = mid + 1
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user