Summary
Keywords
Full Transcript
Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that. NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we discuss the solution of the popular puzzle - Tower of Hanoi using recursion. With this code, we explain the Euler tree formed for the recursive logic and also the memory for this code. In this problem, 1. There are 3 towers. Tower 1 has n disks, where n is a positive number. Tower 2 and 3 are empty. 2. The disks are increasingly placed in terms of size such that the smallest disk is on top and largest disk is at bottom. 3. You are required to 3.1. Print the instructions to move the disks. 3.2. from tower 1 to tower 2 using tower 3 3.3. following the rules 3.3.1 move 1 disk at a time. 3.3.2 never place a smaller disk under a larger disk. 3.3.3 you can only move a disk at the top. To understand this puzzle, click here: https://youtu.be/uwrc4H3yaJ4 To attempt and submit this question, click here: https://www.pepcoding.com/resources/online-java-foundation/introduction-to-recursion/toh-official/ojquestion For a better experience and more exercises, VISIT: https://www.pepcoding.com/resources/online-java-foundation #recursion #algorithms #towerofhanoi #pepcoding #programming #freeonlinecourses Have a look at our result: https://www.pepcoding.com/placements Follow us on our FB page: https://www.facebook.com/pepcoding Follow us on Instagram: https://www.instagram.com/pepcoding Follow us on LinkedIn: https://www.linkedin.com/company/pepcoding-education
