(Choose 1 answer)
(See picture)
A. Only (i)
B. None of them
C. Only (ii)
D. Both of them
Which of the following algorithms are recursive?
(i) procedure A(b, n: integers with n ≥ 0)if n = 0 then A(b, n):= 1;else if n mod 2 = 0 then A(b, n) = A(b, n div 2)2 else A(b, n) = b* A(b, n div 2)2
(ii) procedure A(b, n: integers with n ≥ 0)if n = 0 then y: = 1;elsebeginy: = 1;for i:=1 to n
y: = y*b;
end
Q: 46