📅  最后修改于: 2022-03-11 14:45:22.799000             🧑  作者: Mango
def binary_search(group, suspect):
group.sort()
midpoint = len(group)//2
while(True):
if(group[midpoint] == suspect):
return midpoint
if(suspect > group[midpoint]):
group = group[midpoint]
if(suspect < group[midpoint]):
group = group[0: midpoint]
midpoint = (len(group)//2)