Commit 3c6c8b73 by BellCodeEditor

save project

parent ff00b563
Showing with 15 additions and 0 deletions
......@@ -7,4 +7,19 @@ num = random.choice(alist)
# 请完善二分查找函数binary_search(),查找出num在列表alist里面的索引位置
def binary_search(alist,num):
low=0
num=20
high=len[]-1
while True:
mid=[low + high]//2
num=20
if num==list[mid]:
print("找到了")
return mid
elif num_list(mid):
high=mid-1
else:
low=mid+1
print("没找到")
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