You are on page 1of 1

Data Structures and Algorithms in Java

(Third Edition)
M. T. Goodrich and R. Tamassia
John Wiley & Sons
Solution of Exercise C-4.1
The recursive algorithm, product(n, m), for computing product using only
addition and subtraction, is as follows: If m = 1 return n. Otherwise, return
n plus the result of a recursive call to the method product with parameters
n and m − 1.

You might also like