Question

In: Computer Science

Complete the following recursively defined functions. Base case ?(0)=3 Recursive case ?(?) = 3?(? − 1)...

Complete the following recursively defined functions.

Base case ?(0)=3

Recursive case ?(?) = 3?(? − 1) + 7 for n ≥ 1.

?(1) = ______

f(2) = _______

f(3) = ______

f(4) = ______

Base case ?(0)=1, ?(1)=2

Recursive case ?(?) = ?(? − 1)?(? − 2) for n ≥ 2.

g(2) = ______

g(3) = ______

g(4) = ______

g(5) = ______

Solutions

Expert Solution

So, as we have to give the value of the functions given in the question.

So, let's get started:

It is given that for n = 0, f(0) = 3,and the recursive function is, 

f(n) = 3f(n-1) + 7 for n>=1

Now, to find values of this function at different values we are going to put the value of n in the function:

Hence, f(1) = 3*f(1-1) + 7
            = 3*f(0) + 7 
            = 3*3 + 7               ----->(f(0) = 3, given)
            = 16.
Now, f(2) = 3*f(1) + 7
          = 3*16 + 7                ------>(f(1) = 16, we calculated)
          = 55
and, f(3) = 3*f(2) + 7
          = 3*55 + 7
          = 172
and f(4) = 3*f(3) + 7
         = 3*172 + 7
         =  523

         

So, this was all about the values of f for different values.

Now, let's discuss about the function g:

It is given that for n = 0, g(n) = 1 and for n = 1, g(n) = 2 ,and the recursive function is, 
g(n) = g(n-1)*g(n-2) for n>=2

Now, to find values of this function at different values we are going to put the value of n in the function:

Hence, g(2) = g(2-1)*g(2-2)
            = g(1)*g(0) 
            = 2 * 1                 ----->(g(0) = 1 and g(1) = 2, given)
            = 2.
Now, g(3) = g(2) * g(1)
          = 2 * 2                   ------>(g(1) = 2,given and g(2) = 2, we calculated)
          = 4
and, g(4) = g(3) * g(2)
          = 4 * 2
          = 8
and g(5) = g(4) * g(3) 
         = 8 * 4
         =  32

         

So, this was all about the values of g for different values.

So, this was the solutions of the problem.

I hope I am able to solve your problem, if yes then do give it a like.

It really helps :)


Related Solutions

1.Prove the following statements: . (a) If bn is recursively defined by bn =bn−1+3 for all...
1.Prove the following statements: . (a) If bn is recursively defined by bn =bn−1+3 for all integers n≥1 and b0 =2, then bn =3n+2 for all n≥0. .(b) If cn is recursively defined by cn =3cn−1+1 for all integers n≥1 and c0 =0, then cn =(3n −1)/2 for all n≥0. .(c) If dn is recursively defined by d0 = 1, d1 = 4 and dn = 4dn−1 −4dn−2 for all integers n ≥ 2, then dn =(n+1)2n for all n≥0.
A set M of numbers is defined recursively by 1. 2 and 3 belong to M...
A set M of numbers is defined recursively by 1. 2 and 3 belong to M 2. If x and y belong to M, so does x * y Which of the following numbers belong to M? 6, 9, 16, 21, 26, 54, 72, 218
In this question we study the recursively defined functions f, g and h given by the...
In this question we study the recursively defined functions f, g and h given by the following defining equations f(0) = −1 base case 0, f(1) = 0 base case 1, and f(n) = n · f(n − 1) + f(n − 2)^2 recursive case for n ≥ 2. and g(0, m, r, k) = m base case 0, and g(n, m, r, k) = g(n − 1, r,(k + 2)r + m^2 , k + 1) recursive case for...
In this question we study the recursively defined functions f, g and h given by the...
In this question we study the recursively defined functions f, g and h given by the following defining equations f(0) = −1 base case 0, f(1) = 0 base case 1, and f(n) = n · f(n − 1) + f(n − 2)^2 recursive case for n ≥ 2. and g(0, m, r, k) = m base case 0, and g(n, m, r, k) = g(n − 1, r,(k + 2)r + m^2 , k + 1) recursive case for...
CHALLENGE ACTIVITY 9.4.1: Recursive function: Writing the base case. Add an if branch to complete double_pennies()'s...
CHALLENGE ACTIVITY 9.4.1: Recursive function: Writing the base case. Add an if branch to complete double_pennies()'s base case. Sample output with inputs: 1 10 Number of pennies after 10 days: 1024. the program language is python. please highlight the code for me to copy. thanks  
Give a recursive algorithm to solve the following recursive function. f(0) = 0;    f(1) = 1;...
Give a recursive algorithm to solve the following recursive function. f(0) = 0;    f(1) = 1;   f(2) = 4; f(n) = 2 f(n-1) - f(n-2) + 2; n > 2 b) Solve f(n) as a function of n using the methodology used in class for Homogenous Equations. Must solve for the constants as well as the initial conditions are given.
1.what is a base condition of recursive function? 2. why is the base condition of recursive...
1.what is a base condition of recursive function? 2. why is the base condition of recursive function important?
Let {an} be a sequence defined recursively by a1 = 1 and an+1 = 2√ 1...
Let {an} be a sequence defined recursively by a1 = 1 and an+1 = 2√ 1 + an where n ∈ N (b) Does {an} converge or diverge? Justify your answer, making sure to cite appropriate hypotheses/theorem(s) used. Hint : Try BMCT [WHY?]. (c) (Challenge) If {an} converges then find its limit. Make sure to fully justify your answer.
Find f(1), f(2), f(3) and f(4) if f(n) is defined recursively by f(0)=4f(0)=4 and for n=0,1,2,…n=0,1,2,…...
Find f(1), f(2), f(3) and f(4) if f(n) is defined recursively by f(0)=4f(0)=4 and for n=0,1,2,…n=0,1,2,… by: (a) f(n+1)=−2f(n) f(1)= f(2)= f(3)= f(4)= (b) f(n+1)=4f(n)+5 f(1)= f(2)= f(3)= f(4)= (b) f(n+1)=f(n)2−4f(n)−2 f(1)= f(2)= f(3)= f(4)=
C++ Recursive Functions: Please call functions in a main function as well. 1. A recursive function...
C++ Recursive Functions: Please call functions in a main function as well. 1. A recursive function that print the reverse of a string. (e.g., void printReverse(string exp)). For example, if exp =”coding”, then the function should print out “gnidoc”. 2. Implement a non-recursion-based binary search function. Convert this function into a recursion-based function. 3. Implement a recursive and non-recursive Fibonacci function.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT