recategorized by
3,136 views

3 Answers

3 votes
3 votes

The Recursive equation will be T(n) = 2T(n-1) + 1                          

  BASE CASE will be T(n)=1    if n=0;

Using back substitution  method solve the above equation we will get

Number of Invocation/recursion as 2^(n+1) -1                        

0 votes
0 votes
It's depend upon code implementation

But it's possible 2^n -1 invocation with a modification in a toh code if in gate ask no of invocation with writing code than best answer is 2^n -1 or if ask with code than write the recrance relations and find out no of invocation.....

Related questions

1 votes
1 votes
1 answer
1
radha gogia asked Jul 21, 2015
2,178 views
I have already gone through the links of stackoverflow on this topic but still couldn't understand it clearly , so please explain the logic behind this .
2 votes
2 votes
1 answer
2
Naveen Kumar 3 asked Jul 18, 2018
1,180 views
a) Wednesdayb)Tuesdayc)Thursdayd)Fridaye)None of the above
5 votes
5 votes
5 answers
3
shikharV asked Nov 15, 2015
3,120 views
______ is the number of moves of the smallest disc in Tower of Hanoi implementation where the tower consisting of 17 discs (numbered from 0 to 16)Answer given: $2^{16}$ ...