Python3: 二分法查找的两种实现方法
下标 while start <= end: #定义中间值下标: split = (start + end) // 2 if item == listx[split]: return True elif item < list[split]: end = split-1 else: start = split+1 return False #功能测试: if __name__ == "__main__": list = [-300, -10, 2, 23, 29, 58, 59, 102...阅读全文