使用python实现数据结构算法 发表于 2020-08-03 分类于 数据结构 阅读次数: 二分查找12345678910111213def binary_search(list, item): low = 0 high = len(list) - 1 while(low <= high): mid = (low + high) // 2 guess = list[mid] if guess == item: return mid elif guess > item: high = mid - 1 elif guess < item: low = mid + 1 return None