Commit f59cdef3 by BellCodeEditor

save project

parent 3c29bc2f
Showing with 2 additions and 3 deletions
...@@ -13,11 +13,11 @@ def binary_search(alist,num): ...@@ -13,11 +13,11 @@ def binary_search(alist,num):
d=(low+higt)//2 d=(low+higt)//2
f=alist[d] f=alist[d]
if f==num: if f==num:
print(f)
return d return d
elif f<num: elif f<num:
low=d+1 low=d+1
else: else:
higt=d-1 higt=d-1
binary_search(alist,num) print("索引",binary_search(alist,num))
\ 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