Commit 02020452 by BellCodeEditor

save project

parent b2ee97cf
Showing with 3 additions and 3 deletions
# 使用二分查找法,找出9和20在列表里面的索引 # 使用二分查找法,找出9和20在列表里面的索引
num_list = [1, 3, 5, 8, 9, 11, 15, 17, 18, 20, 21, 36, 44, 55, 57] num_list = [1, 3, 5, 8, 9, 11, 15, 17, 18, 20, 21, 36, 44, 55, 57, 67, 74, 76, 84, 91, 93, 98, 100]
index = 0 index = 0
bingo_num = [9, 20, 55] bingo_num = [9, 20, 55, 76, 98]
low,high = 0,len(num_list) - 1 low,high = 0,len(num_list) - 1
while index < 3: while index < len(bingo_num):
low,high = 0,len(num_list) - 1 low,high = 0,len(num_list) - 1
while low <= high: while low <= high:
mid = (low + high) mid = (low + high)
......
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