let' call the initial tree-shaped (or pyramid-shapedarrangement of disks on tower tree as you experiment with the appletyou'll begin to notice that smaller tree-shaped stacks of disks are generated as part of the solution process let' call these smaller treescontaining fewer than the total number of diskssubtrees for exampleif you're trying to transfer disksyou'll find that one of the intermediate steps involves subtree of disks on tower bas shown in figure these subtrees form many times in the solution of the puzzle this is because the creation of subtree is the only way to transfer larger disk from one tower to anotherall the smaller disks must be placed on an intermediate towerwhere they naturally form subtree figure subtree on tower here' rule of thumb that may help when you try to solve the puzzle manually if the subtree you're trying to move has an odd number of disksstart by moving the topmost disk directly to the tower where you want the subtree to go if you're trying to move subtree with an even number of disksstart by moving the topmost disk to the intermediate tower the recursive algorithm the solution to the towers of hanoi puzzle can be expressed recursively using the notion of subtrees suppose you want to move all the disks from source tower (call it sto destination tower (call it dyou have an intermediate tower available (call it iassume there are disks on tower here' the algorithm move the subtree consisting of the top - disks from to move the remaining (largestdisk from to move the subtree from to when you beginthe source tower is athe intermediate tower is band the destination tower is figure shows the three steps for this situation firstthe subtree consisting of disks and is moved to the intermediate tower then the largest disk is moved to tower then the subtree is moved from to of coursethis doesn' solve the problem of how to move the subtree consisting of disks and to tower bbecause you can' move subtree all at onceyou must move it one disk at time moving the -disk subtree is not so easy howeverit' easier than moving disks as it turns outmoving disks from to the destination tower can be done with the same steps as moving disks that ismove the subtree consisting of the top disks from tower to intermediate tower cthen move disk from to then move the subtree back from to