标签:fibonacci [1] function turn fun create pre cti for
function fib1(n)
if n=0:return 0
if n=1:return 1
return fib1(n-1)+fib1(n-2)
function fib2(n)
if n=1:return 0
create an array f[0...n]
f[0]=0,f[1]=1
for i=2...n:
f[i]=f[i-1]+f[i-2]
reutrn f[n]
标签:fibonacci [1] function turn fun create pre cti for
原文地址:https://www.cnblogs.com/seastargreen/p/10368490.html