Question: Exercise 1 . Hopping Up Steps - recursive formula We are given the following problem: figure out how many ways we can hop up n
Exercise Hopping Up Steps recursive formula
We are given the following problem: figure out how many ways we can hop up n steps, if at every point we can make one hop of d steps, where d is one of the following dotsdk
For example, if we can hop either one or two steps at a time, there are FIVE valid ways to hop steps:
This problem is somewhat similar to the problem of finding out the minimum number of coins to make change for amount n with denominations dotsdk
Note: When k is there is only one type of hop to make the answer should not be more than
a Find the recursive formula for computing findNumWaysndotsdk
Carefully explain why your formula is correct.
b Create working Python code for findNumWaysR, which is a recursive method based on your formula in a and test that it works correctly. Test it for various inputs, such as findNumWaysR findNumWaysRfindNumWaysR
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
