Commit a0f256f7 by BellCodeEditor

save project

parent 37c1d633
Showing with 16 additions and 3 deletions
...@@ -8,5 +8,19 @@ num = random.choice(alist) ...@@ -8,5 +8,19 @@ num = random.choice(alist)
def binary_search(alist,num): def binary_search(alist,num):
z=0 z=0
x=9 x=9
n=len(a)-1 while True:
\ No newline at end of file v=(z+x)//2
b=alist[v]
if b==num:
print("hhhhhh")
print(v)
break
elif b<9:
z=v+1
else:
x=v-1
if z>x:
print("cao")
break
binary_search(alist,num)
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