Commit 06583e5e by BellCodeEditor

auto save

parent d8bbb72f
Showing with 9 additions and 2 deletions
......@@ -14,4 +14,11 @@ def binary_search(alist,num):
mid=(high+low)//2
if alist[mid]==num:
return mid
elif
\ No newline at end of file
elif alist[mid]<num:
low=mid+1
else:
high=mid-1
return None
result=binary_search(alist,num)
print("老师给出的书是:",result)
print("他在列表中的索引是:",mid)
\ No newline at end of file
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