Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

int func1 (int m, int n) { if (m==n || n==1) return 1; else return func1(m-1,n-1

ID: 3615783 • Letter: I

Question

int func1 (int m, int n)
{
     if (m==n || n==1)
             return 1;
     else
             return func1(m-1,n-1) + n*func1(m-1,n);
}


Based on the function above;

a) What precondition must exist in order to prevent the code abovefrom infinite recursion?
a. m >= 0 and n >=0        b. m >= 0 andn>= 1
c. m >= 1 and n >=0        d. m >= 1 andn >= 1

b) What is the value of func1(5, 3)?
a. 15    b. 21
c. 28    d. 32

c) Which of the following would be an invalid call to the functionabove?
a. func1(0,1)    b. func1(1,0)
c. func1(4,9)    d. func1(99999, 99999)

Explanation / Answer

please rate - thanks int func1 (int m, int n) {      if (m==n || n==1)              return 1;      else              return func1(m-1,n-1) + n*func1(m-1,n); } Based on the function above; a) What precondition must exist in order to prevent the code abovefrom infinite recursion? a. m >= 0 and n >=0        b. m >= 0 andn>=1                     b)m>=0,n>=1 c. m >= 1 and n >=0        d. m >= 1 andn >= 1 b) What is the value of func1(5,3)?       none of these25      --I ran it a. 15    b. 21 c. 28    d. 32 c) Which of the following would be an invalid call to the functionabove? a. func1(0,1)    b. func1(1,0)                             b) because n=0 c. func1(4,9)    d. func1(99999,99999)