摘要:
lst = [i for i in range(20, 0, -1)] length = len(lst) r = length // 2 while r: for i in range(length - r): if lst[i] > lst[i + r]: lst[i], lst[i + r] = lst[i + r], lst[i] ... 阅读全文
摘要:
回调函数: A callback is a function that is passed as an argument to another function and is executed after its parent function has completed. 我的理解就是, 回调函数 阅读全文
摘要:
二分查找:每次能够排除掉一半的数据,查找的效率非常高,但是局限性比较大。必须是有序序列才可以使用二分查找。1.非递归算法 def binary_search(lis, nun): left = 0 right = len(lis) - 1 while left lis[mid]: # 如果查询数字比中间数字大,那么去二分后的右边找 left =... 阅读全文