Commit c5baa157 by BellCodeEditor

auto save

parent 47ae974e
Showing with 2 additions and 2 deletions
...@@ -8,8 +8,8 @@ num = random.choice(alist) ...@@ -8,8 +8,8 @@ num = random.choice(alist)
def binary_search(alist,num): def binary_search(alist,num):
low=0 #定义变量 low=0 #定义变量
high=len(alist)-1 high=len(alist)-1
while low <= high: # while low <= high: #当最小的小于最大的时
mid=(low+high)//2 mid=(low+high)//2 #找到中间值
guess=alist[mid] guess=alist[mid]
if guess==num: if guess==num:
return mid return mid
......
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