Q1: 15 points Q2: 25 points Q3: 30 points plus 5 extra credit Q4: 30 points Total: 100 points plus 5 extra credit
Write an equation for T(n+1) in terms of T(n), and use this equation to prove by (ordinary) induction that for any natural n, T(n) = n(n+1)(n+2)/6.
The following pseudo-Java method is intended to compute Z(n):
public natural zcode (natural n)
{// Returns Z(n) as defined above
if (n <= 1) return n;
return 2 * zcode (n/2);}
This question have three parts, all of which refer to the function Z:
zcode
does in fact
compute Z(n) as defined. (Hint: Use strong induction on n, with two
base cases.)
Prove by (strong) induction on all positive naturals n that Z(n) is a power of two, where Z is the function defined above. (Make sure that you use the appropriate base case for positive naturals.)
Last modified 1 April 2005