Saint Louis University |
Computer Science 180
|
Dept. of Math & Computer Science |
Topic: Recursion
Related Reading: Ch. 2.5.1, 4.1, 10.1.1, 10.3
Due:
Tuesday, 28 March 2006, 1:10pm
Please make sure you adhere to the policies on academic integrity.
Describe a recursive algorithm to compute the product of two positive integers, m and n, using only additions. (thus you should not use the binary * operator). Your code should have a signature:
int Product(int m, int n);
Ch 2.5.1 describes a recursive procedure drawTicks(int tickLength). For this problem, we are interested in determining the number of lines of output which are generated by a call drawTicks(L) for a given integer L, including all of the recursive calls it generates.
As a function of L, how many lines of output are
generated?
(Hint: You might wish to try out a few small values by hand)
Give a proof of your result!