查找法

# 二分查找spa

def func(lists, m)it

low = 0while

height = len(lists)-1return

mid  = (low+height)//2

while low < height:
if  lists[mid] = m:

  return mid

elif lists[mid] > m:

height = mid -1

elif lists[mid] < m:

low = mid +1

mid = (low + height)//2

相關文章
相關標籤/搜索