We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cee38ed commit 86fdac9Copy full SHA for 86fdac9
1 file changed
pygorithm/searching/binary_search.py
@@ -32,7 +32,7 @@ def search(_list, target):
32
try:
33
# you can also write while True condition
34
while left <= right:
35
- mid = (left + right) // 2
+ mid = left + (right - left) // 2
36
if target == _list[mid]:
37
return mid
38
elif target < _list[mid]:
0 commit comments