Question: 3. Analyse the algorithm, fill in the blanks to complete the code and answer the question. M and n are both natural numbers. If m

 3. Analyse the algorithm, fill in the blanks to complete the

3. Analyse the algorithm, fill in the blanks to complete the code and answer the question. M and n are both natural numbers. If m is given, we can add up some natural numbers that are less than or equal to n to get m. For example, if n=3 and m=5, we can split m into 1+1+3 or 2+1+2, The function f(m,n) returns the number of ways m could be denoted. On the previous example, f(5,3)=5 as 3+2,3+1+1,2+2+1,2+1+1+1,1+1+1+1+1. (5pts, 1 pt per blank) (1) Please fi11 in the blanks to complete the code for f(m,n). (2) If we call f(6,4), the return value will be

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!