I have the function f(n) = 1 + (-1)^n
This bounces between 0 for n=odd number and 2 for n=even number. But I don't know how to write it recursively. The problem provides the first part as
f(n-2) +
and I have to fill in the rest. The thing I have come up with is f(n-2) + f(n-1). But that doesn't work for when n is an odd number. Can anyone help me out here or give me some hints?


LinkBack URL
About LinkBacks