2.8 二分搜索 def binary_search(A,k): first = 0 last = len(A)-1 found =False while first<=last and not found: midpoint=(first+last) // 2 if A[midpoint]==k: found = True else: if k<[midpoint]: last = midpoint-1 else: first= midpoint+1 return found