I need an example of a recursive function in which the amoun

I need an example of a recursive function in which the amount of work on each activation is constant. Provide the recurrence equation and the initial condition that counts the number of operations executed. Specify which operations you are counting and why they are the critical ones to count to assess its execution time. Draw the recursion tree for that function and determine the Big- by determining a formula that counts the number of nodes in the tree as a function of n.

Solution


int p(int n,int a)
{
if (a == 4)
return a;
a= a +1 ;
return p(n,a);
}

p is a function which takes 2 parameter a and n

a equal to 4 is a terminating condition

I need an example of a recursive function in which the amount of work on each activation is constant. Provide the recurrence equation and the initial condition

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site