def BinarySearch(lst,key):
min = 0
max = len(lst)
center = int((min+max)/2)
if key in lst:
while True:
if key>lst[center]:
max=center
elif key<lst[center]:
min=center
else: key==lst[center]:
return center
else:
return
Python 二分查找
最新推荐文章于 2022-09-25 22:32:33 发布