练习1.10
Ackermann数学函数:
(define (A x y)
(cond ((= y 0) 0)
((= x 0) (* 2 y))
((= y 1) 2)
(else (A (- x 1)
(A x (- y 1))))))
A(x,y)=⎩⎨⎧0,2y,A(x−1,A(x,y−1)),y=0x=0other cases
(A 1 10)
(A 2 4)
(A 3 3)
定义如下过程:
(define (f n) (A 0 n))
(define (g n) (A 1 n))
(define (h n) (A 2 n))
易知:
f(n)=2ng(n)=2nh(n)=22..2(n times)