Skip to content

Instantly share code, notes, and snippets.

View biniamHaddish's full-sized avatar
🎯
Focusing

Biniam Berhane biniamHaddish

🎯
Focusing
View GitHub Profile
@biniamHaddish
biniamHaddish / BinarySearch.py
Created September 25, 2017 05:46
A simple binary search in Python
def binary_search(array,item):
low=0;
high=len(array)-1;
while low<=high:
mid=(high+low);
guess=array[mid];
if guess== item:
return mid;
if guess > high:
high=mid-1;