python——數據結構之二分法查找

# coding:utf-8 # [17, 20, 26, 31, 44, 54, 55, 77, 93] # mid = n/2 # # [17, 20, 26, 31] # mid = n/2 def binary_search(alist, item): """二分查找,遞歸""" n = len(alist) if n > 0: mid = n//
相關文章
相關標籤/搜索