mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-20 05:29:48 +00:00
make code more readable (#1304)
This commit is contained in:
parent
25701a9877
commit
0da4d0a7f3
@ -43,11 +43,10 @@ def binary_search(sorted_collection, item):
|
|||||||
current_item = sorted_collection[midpoint]
|
current_item = sorted_collection[midpoint]
|
||||||
if current_item == item:
|
if current_item == item:
|
||||||
return midpoint
|
return midpoint
|
||||||
|
elif item < current_item:
|
||||||
|
right = midpoint - 1
|
||||||
else:
|
else:
|
||||||
if item < current_item:
|
left = midpoint + 1
|
||||||
right = midpoint - 1
|
|
||||||
else:
|
|
||||||
left = midpoint + 1
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user