SICP Exercise 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.
Part 1: Recursive
The code is here.
Part 2: Iterative
The code is here.
Part 3: Tests
The tests and results are here.
Part 1: Recursive
The code is here.
Part 2: Iterative
The code is here.
Part 3: Tests
The tests and results are here.
Comments
Post a Comment