Commit 018dfb3d by BellCodeEditor

save project

parent 1823b080
Showing with 13 additions and 3 deletions
......@@ -14,5 +14,15 @@ def binary_search(alist,num):
mid = (low + high) //2
cai = alist[mid]
if cai == num:
raise mid
elif cai <num
\ No newline at end of file
return mid
elif cai < num:
low = mid +1
else:
high = mid - 1
return -1
result = binary_search(altst,num)
if result < 0:
print(str(num)+"没找到")
else:
print(str(num)+找到,"wei"+str(result))
\ 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