48.2k views
1 vote
3. Write a recursive algorithm of the sequence t(1)=1 and t(n)=n2 t(n-1) as a function.

User Estefany
by
8.2k points

1 Answer

1 vote

Answer:

int t(int n){

if(n == 1)

return 1;

else

return n*n*t(n-1);

}

Explanation:

A recursive function is a function that calls itself.

I am going to give you an example of this algorithm in the C language of programming.

int t(int n){

if(n == 1)

return 1;

else

return n*n*t(n-1);

}

The function is named t. In the else clause, the function calls itself, so it is recursive.

User MathCatsAnd
by
7.9k points

No related questions found