1,097 views

2 Answers

2 2 votes

$T_{0}=0\ ,\ T_{1}=1\ given\ in\ question $

Let's there is 

$T{_{2}}=T{_{1}}+T {_{0}}$

$T{_{1}}\ will\ call\ first\ and\ return\ 1\ and\ make\ space\ for \ T{_{0}}$

$it\  means\ T{_{1}}\ and\ T{_{0}}\ will\ share\ same\ space$

$say\ n=4$

$T_{1}$
$T_{2}$
$T_{3}$
$T_{4}$

 

$T_{1}\ and\ T_{0}\ values\ are\ store\  in\ table\ so \ no\ need\ to\ evaluate\ them.$

$in\ this\ question\ maximum\ number\ of\ function\ call\ before\ stack\ overflow\ is\ $

$n*4=48$

n=12

• edited by
0 0 votes
Let n = 4                   T(4)

                     T(3)               T(2)

               T(2)      T(1)     T(1)    T(0)

          T(1)    T(0)

So for n=4  4 levels of stack needed. now for 12 levels stack n=12
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.9k
1.9k views
1 1 vote
1 1 answer
1.4k
1.4k views
srestha asked May 22, 2019
1,405 views
A stack based CPU executes the instruction. Memory location $500$ contain $0X 88$ and memory location $700$ contain $0X37$. The stack pointer is at $0X003F$The instructio...
3 3 votes
3 3 answers
2.0k
2.0k views
srestha asked May 6, 2019
1,980 views
There is given a infix expression: ${\color{Red} {1}}$$A+B\times C/\left ( \left ( D+E \right )+F\times G \rig...
2 2 votes
0 0 answers
1.2k
1.2k views
Akash Mishra asked Jul 26, 2017
1,225 views
The correct answer to the following question is 24. Please explain.