recursion anotherall the smaller disks must be placed on an intermediate towerwhere they naturally form subtree 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 solution 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 three-disk subtree is not so easy howeverit' easier than moving four disks as it turns outmoving three disks from to the destination tower can be done with the same three steps as moving four disks that ismove the subtree consisting of the top two disks from tower to intermediate tower cthen move disk from to then move the subtree back from to how do you move subtree of two disks from to cmove the subtree consisting of only one disk ( from to this is the base casewhen you're moving only one diskyou just move itthere' nothing else to do then move the larger disk ( from to cand replace the subtree (disk on it