Binary Search with python
Will be added!
Binary Search algorithm
def binary_search(array, target, start, end):
while start <= end:
mid = (start+end)//2
if array[mid] == target:
return mid
elif array[mid] >= target:
end = mid - 1
else:
start = mid + 1
return None
This post is part of Python-Team-Notes for coding test posting that I posted. If you have any questions or mistakes regarding the code, please point it out!
Leave a comment