Commit 66436a42 by BellCodeEditor

save project

parent a6268afd
Showing with 6 additions and 3 deletions
......@@ -14,8 +14,11 @@ def binary_search(alist,num):
guess=alist[mid]
if guess==num:
return mid
elif guess<num:
elif guess<num: #最小索引查找
low=mid+1
else:
high=mid-1
return None
\ No newline at end of file
return None
aa = binary_search(alist,num)
print("数为",num)
print("索引为",aa)
\ 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