Commit daa791ad by BellCodeEditor

save project

parent 2ffc5675
Showing with 3 additions and 3 deletions
...@@ -12,11 +12,11 @@ def binary_search(alist,num): ...@@ -12,11 +12,11 @@ def binary_search(alist,num):
while l<=h: while l<=h:
m=(l+h)//2 m=(l+h)//2
g=alist[m] g=alist[m]
if g==bg: if g==num:
return m return m
elif g<bg: elif g<num:
l=m+1 l=m+1
elif g>bg: elif g>num:
h=m-1 h=m-1
return num return num
a=binary_search(alist,num) a=binary_search(alist,num)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment