SICP 习题解答 1.11
Exercise 1.11. A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n> 3. Write a procedure that computes f by means of a recursive process. Write a procedure that computes f by means of an iterative process.
my solution:
recursive process
复制代码
iterative process
复制代码
多写了一对括号,检查半天才查出来,真要命。
error message 是准确的,为什么不盯着 error message 想呢,就算不能马上想起来,也比乱找好。
every mistake is a lesson and every lesson will make you better.
评论