且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

递归与迭代(Fibonacci序列)

更新时间:2021-09-01 23:33:35

对于简洁性,设F(x)为递归Fibonacci

For terseness, Let F(x) be the recursive Fibonacci

F(10) = F(9)                      + F(8)
F(10) = F(8)        + F(7)        + F(7) + F(6)
F(10) = F(7) + F(6) + F(6) + F(5) + 4 more calls.
....

所以你要两次拨打F(8),
F(7)3次,F(6)5次,F(5)7次..依此类推

So your are calling F(8) twice, F(7) 3 times, F(6) 5 times, F(5) 7 times.. and so on

因此,输入越大,树变大更大。

So with larger inputs, the tree gets bigger and bigger.