【SICP练习】126 练习3.57
2015-03-28 22:28
441 查看
练习3-57
原文
Exercise 3.57. How many additions are performed when we compute the nth Fibonacci number using the definition of fibs based on the add-streams procedure? Show that the number of additions would be exponentially greater if we had implemented (delay ) simply as (lambda () ), without using the optimization provided by the memo-proc procedure described in section 3.5.1.分析
斐波那契中每个数都会由前两个数计算而来。因此斐波那契数列要求每一次求和时对空间的需求没有增加。当回头调用前面计算过的斐波那契数时不必重新计算。因为没有计算的是从0和1开始的,因此计算fib(n)至少需要fib(n)-1次加法。感谢访问,希望对您有所帮助。 欢迎关注或收藏、评论或点赞。
为使本文得到斧正和提问,转载请注明出处:
http://blog.csdn.net/nomasp
相关文章推荐
- 【SICP练习】126 练习3.57
- 【SICP练习】9 练习1.15
- 【SICP练习】125 练习3.56
- 【SICP练习】149 练习4.5
- 【SICP练习】63 练习2.34
- 【SICP练习】103 练习2.81-2.97
- 【SICP练习】65 练习2.36
- 【SICP练习】128 练习3.59
- 【SICP练习】19 练习1.25
- 【SICP练习】12 练习1.18
- 【SICP练习】114 练习3.38-3.39
- SICP-《计算机程序的构造和解释》之习题分析与收获——练习1.30
- SICP练习1.6 1.16 解答
- 【SICP练习】25 练习1.31
- 【SICP练习】38 练习1.43
- 【SICP练习】62 练习2.33
- 【SICP练习】78 练习2.50
- 【SICP练习】94 练习2.67
- 【SICP练习】109 练习3.22
- 【SICP练习】130 练习3.61