mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08: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]
|
||||
if current_item == item:
|
||||
return midpoint
|
||||
elif item < current_item:
|
||||
right = midpoint - 1
|
||||
else:
|
||||
if item < current_item:
|
||||
right = midpoint - 1
|
||||
else:
|
||||
left = midpoint + 1
|
||||
left = midpoint + 1
|
||||
return None
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user