Answer the question
In order to leave comments, you need to log in
A problem about a grasshopper and posts. Why does the recursive formula give the correct answer?
I watched an analysis of a problem about a grasshopper, which can only jump one step or two steps forward on the posts. The problem asks how many ways there are to jump to the i-th column. As a result, the formula turns out like this:
d[n] = d[n-1] + d[n-2], which in fact is the formula that specifies the sequence of Fibonacci numbers F(n) = F(n-1) + F(n -2)
What I can't understand is why this formula gives the correct answer.
For example, if we calculate d[4], then there will be d[3] + d[2] = 5 ways to jump to the fourth column. But after all, we have already taken into account d[2] for d[3], why add d[3] to d[2] again?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question