Please do not solve other peoples homework.

Give him some hints, try to make him thinking about

the problem, but do not post a program he can turn in

without actually having mastered the problem by himself.

Hanoi is often used to check if a student has grasped

the concept of recursion. He needs to build up a mental

model on how recursion works in order to solve it with

recursion:

a) What makes the problem complicated?

b) What parameter can be made simpler, such that

finally this parameter reaches 0 or 1 or any other

trivial case.

c) What is the trivial case, how can it be solved?

d) How can I use a simpler solution to find the solution

for the more complex problem.

By providing him a complete workable solution,

you have defeated that intention.

Thank you.

PS (for the OP):

a) the number of disks. Obviously, if no disk must be moved

the problem is so simple, that even a 2 year old child can solve

it: do nothing.

b) again, the number of disks. Moving n-1 disks is easier then

moving n disks.

c) Having to move 0 disks. No action is required then.

d) To move n disks from a StartPad to GoalPad with the help

of a ParkingPad:

* move n-1 disks from StartPad to ParkingPad, in order to free

the n-th disk for movement. You can use the GoalPad as the parking pad.

* move the n-th disk from StartPad to GoalPad

* move the n-1 disks you have parked at ParkingPad, from ParkingPad

to GoalPad, this time you can use the StartPad as the parking pad.

moving n-1 disks is simpler then moving n disks. Thus the above

uses the solution of simpler problems to solve the problem for n.