edited by
1,348 views
7 votes
7 votes

Consider the following recursive function which is used by dynamic programming.

Assume for every function call T(i) it checks the table first, if its value is already computed it retrieves the value from table. Otherwise it calls a recursive function call to compute its return value. Whenever a function T(i) computes for first time its return value is stored in the table to avoid the redundant function calls.
The number of function calls that need the support of stack to complete the execution of the function T(12) are __________ .

edited by

1 Answer

Best answer
9 votes
9 votes

It should be $\large\color{red}{21}$

selected by
Answer:

Related questions

3 votes
3 votes
3 answers
1
Laxman Ghanchi asked May 19, 2023
1,111 views
#include<stdio.h void print(int n) { printf("Hello "); if(n++ == 0) return ; print(n); n++; } int main() { void print(); print(-4); }How many times printf execute?? And H...
0 votes
0 votes
1 answer
2
Laxman Ghanchi asked May 19, 2023
657 views
#include<stdio.h>void print(int n){ printf("Hello "); if(n++ == 0) return ; print(n); n++;}int main(){ void print(); print(-4);}
1 votes
1 votes
0 answers
4