Question: Write tail-recursive versions of the following: (a) (b) ;; compute integer log, base 2 ;; (number of bits in binary representation) ;; works only for
Write tail-recursive versions of the following:
(a)

(b)

;; compute integer log, base 2 ;; (number of bits in binary representation) ;; works only for positive integers (define log2 (lambda (n) (if (= n 1) 1 (+ 1 (log2 (quotient n 2))))))
Step by Step Solution
3.27 Rating (162 Votes )
There are 3 Steps involved in it
a b Alternatively defi... View full answer
Get step-by-step solutions from verified subject matter experts
