just name is written no any explanation in question or no any explanation about this problem in previous video , i know it is standard problem , but if someone is solving first time, then how they would know about that?
Just name is written no any explanation in question?
This is the question:
Using a helper stick (peg), shift all rings from peg A to peg B using peg C. All rings are initally placed in ascending order, smallest being on top.
No bigger ring can be placed over a smaller ring.
a. Write a recursive function which prints the steps required to solve the tower of Hanoi problem for N discs.
b. Write a recursive function which returns number of steps required to solve the tower of Hanoi problem for N discs.
Let T1 be the Source Tower, T2 be the Destination Tower and T3 be the Auxillary Tower.
Input Format
Enter the number of discs
Constraints
None
Output Format
Display the steps required to solve the tower and also print the total number of steps required
Sample Input
2
Sample Output
Move 1th disc from T1 to T3
Move 2th disc from T1 to T2
Move 1th disc from T3 to T2
3
Explanation:
Here we have used 7 steps to move all disks from A to C
but why it is not written in question??it is my question
@Vipin_coder,
Might be some technical issue. Try refreshing.
Also: The image I attached is not in the question description. I added it to give you a better understanding of the question
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.