Skip to content

Commit c5365d6

Browse files
committed
binary search did not work because of forgetting a decrement
1 parent 0cebed6 commit c5365d6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

algorithms/searching/binary_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def search(seq, key):
2929
if seq[mid] < key:
3030
lo = mid + 1
3131
elif seq[mid] > key:
32-
hi = mid
32+
hi = mid - 1
3333
else:
3434
return mid
3535
return False

0 commit comments

Comments
 (0)