Skip to content

Commit

Permalink
Merge pull request gzc#186 from dccif/patch-1
Browse files Browse the repository at this point in the history
Update binary-search.py
  • Loading branch information
Zhenchao Gan authored Jan 15, 2018
2 parents 00a8769 + ccf8327 commit 16b3c7d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions C02-Getting-Started/exercise_code/binary-search.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ def binarysearch(items, v):
low = 0
high = len(items)-1
while low <= high:
mid = (low+high)/2
mid = int((low+high)/2)
if(items[mid] == v):
return mid
elif(items[mid] < v):
low += 1
low = mid
else:
high -= 1
high = mid + 1
return None

items = [1,2,3,4,5]
Expand Down

0 comments on commit 16b3c7d

Please sign in to comment.