python 斐波那契查找
2021-06-20 08:06
标签:false lse return class lis result while arch htm python 斐波那契查找 标签:false lse return class lis result while arch htm 原文地址:https://www.cnblogs.com/sea-stream/p/9689116.htmldef fibonacci_search(lis, key):
#
F = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,
233, 377, 610, 987, 1597, 2584, 4181, 6765,
10946, 17711, 28657, 46368]
low = 0
high = len(lis) - 1
#
k = 0
while high > F[k]-1:
k += 1
print(k)
i = high
while F[k]-1 > i:
lis.append(lis[high])
i += 1
print(lis)
#
time = 0
while low lis[mid]:
low = mid + 1
k -= 2
else:
if mid
下一篇:phpcms相关