retagged by
396 views
0 votes
0 votes
T(n)={

0:if n<1

1:if n==1

T(n-1)+T(n-2):n>1

}

if the stack size is 48 bytes and one stack entry size =4 B then maximum n=?

I thought it should be 13 but the answer is 12

T(1) and T(<1) should not be stored they are already given so can we take n=13 so the last call which will be stored will be T(2)
retagged by

1 Answer

0 votes
0 votes
The answer is 12.

The maximum number of levels possible if the stack size is 48 bytes and one stack entry size is 4B = 48/8=12

Hence the maximum value of n which can achieve that many levels of tree is 12.

Related questions

1 votes
1 votes
2 answers
1
Dknights asked Nov 29, 2022
527 views
what if a full binary tree contains both left and right sides as the max heap, then what will be the complexity of making it a proper max heap?