369 views
0 votes
0 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. If system allocated 48 bytes for stack allocation, then the maximum value of ‘n’ so that overflow cannot occur ________. (Assume system allocate 4 byte to each stack entry which is sufficient for storing required data.)

Ans : 12

 

Doubt : 

wont it be the size of active function calls ? so for n=5 its fine, and for n=6 it exceeds 12 , but in given answer n=12 is considered, why ?

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
1
HeadShot asked Jan 2, 2019
198 views
how O(logn) ? if no such a[i] exist in array then in worst case we have to apply binary search for every element and it will take O(nlogn) so better we can have linear se...
0 votes
0 votes
0 answers
2
HeadShot asked Dec 1, 2018
586 views
In worst case, for each "n" we have to check every "n then how O(n) ?
0 votes
0 votes
0 answers
3
HeadShot asked Dec 1, 2018
329 views
0 votes
0 votes
0 answers
4
HeadShot asked Dec 1, 2018
209 views
Better than O(n) exists ?