Exercise 1.11: (back)

Scheme:

;; Recursive Process
(define (f-rec n)
  (cond ((< n 3) n)
        (else (+ (f-rec (- n 1))
                 (* 2 (f-rec (- n 2)))
                 (* 3 (f-rec (- n 3)))))))


;; Iterative Process
(define (f-iter n)
  (f-iter-loop 0 1 2 n))

(define (f-iter-loop a b c count)
  (if (= count 0)
      a
      (f-iter-loop b c (+ c (* 2 b) (* 3 a)) (- count 1))))