Which of the following calculates the greatest common divisor (gcd)? (define (f n) (if (< n 2) n (+ (f (- n 1)) (f (- n
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Which of the following calculates the greatest common divisor (gcd)? (define (f n) (if (< n 2) n (+ (f (- n 1)) (f (- n
Which of the following calculates the greatest common divisor (gcd)? (define (f n) (if (< n 2) n (+ (f (- n 1)) (f (- n 2))))) (define (f a b) (if (= b 0) a (f b (modulo a b)))) (define (f 1) (apply + (map * 1 1))) (define (f n) (if (<= n 0) 1 (* n (f (- n 1))))) ((= m 0) (+ n 1)) ((= n 0) (f (- m 1) 1)) (else (f (-m 1) (f m (- n 1)))))) (define (f m n) (cond
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!