Re: ABS & recursion

new topic     » topic index » view thread      » older message » newer message

At 12:31 05-09-98 +0200, you wrote:

There is problems for which recursion greatly simplify the algorithm.  The
problem of the TOWER OF HANOI is one of those.

TOWER OF HANOI PROBLEM

3 poles, named A,B,C
on pole A there is N disks pinned ( the exact number is not relevant)
the disks are of decreasing diameters, the smallest on top
The problem consist in moving all the disks form pole A to another pole (say B)
respecting the following rules.
1) Only 1 disk can be move at a time.
2) it is fobidden to place a bigger disk over a smaller.
3) the disk can only be stored on anyone of the 3 poles, not aside.

I challenge you to find a solution to that problem without using recursion or
any stack.
Though the recursive solution is quite simple.


Regards,

Jacques D.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu