递归方式实现二分查找
摘要:
lst = [11,22,33,44,55,66,77,88,99] def func(left,right,n): middle = (left + right) // 2 if left > right: return - 1 elif n > lst[middle]: left = middle + 1 elif n < lst[middle]: right = middle - 1 els 阅读全文
posted @ 2019-10-26 22:23 素心~ 阅读(348) 评论(0) 推荐(0) 编辑