Commit 9dde9ab2 by BellCodeEditor

save project

parent 3c57e0df
Showing with 4 additions and 4 deletions
...@@ -3,15 +3,15 @@ num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21] ...@@ -3,15 +3,15 @@ num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21]
cs=20 cs=20
low=0 low=0
high=len(num_list)-1 high=len(num_list)-1
while low<=hight: while low<=height:
mid=(low+height)//2 mid=(low+height)//2
guess=num_list[mid] guess=num_list[mid]
if guess == cs: if guess == cs:
print(”找到目标值,他的索引为“,mid)0 print("找到目标值,他的索引为",mid)
break break
eilf guess<cs: elif guess<cs:
low=mid+1 low=mid+1
else guess<cs: else:
height=mid-1 height=mid-1
......
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