



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The Tower of Hanoi is a mathematical game or puzzle consisting of three rods and a number of disks of various diameters, which can slide onto any rod. The puzzle begins with the disks stacked on one rod in order of decreasing size, the smallest at the top, thus approximating a conical shape
Typology: Summaries
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Using this link ( https://www.mathsisfun.com/games/towerofhanoi.html )
So, we find that for a given N of disks, the way to solve a problem in a minimum
number of steps is:
Therefore, the recurrence relation for this puzzle would become:
*H n = 2 H (n- 1 ) + 1
inter, destination}.
Counter 0 \num of moves tower (n: disk, source, inter, destination) IF n = 1 , THEN Counter Counter + 1 Print “move disk from “ + source + “to ” + destination ELSE Counter Counter + 1 tower (disk - 1 , source, destination, inter) Print “move disk from “+ source +”to “ + destination tower (disk - 1 , inter, source, destination) END IF END Return ( Counter )