A Certain Monk at a certain village in Hanoi

Mark W. Eichin eichin at paycheck.cygnus.com
Sun Mar 20 14:59:30 PST 1994



>> Of course this runs slowly and does tend to use a lot of storage.  
>> The stack really grows too large.  I'm hoping that it may be possible

That's just because it was an intuitive, but excruciatingly
inefficient, implementation. You can do towers of hanoi with *no*
stack, as long as you can loop (and even if you can't explicitly loop,
you can do it tail recursively, which this version isn't, and still
avoid using stack.) It's much harder to recognize that the code
relates to the problem... but if you treat the problem as "generate
this stream of numbers" it's not too hard to see how to do it.

The story behind the original "towers of hanoi" problem (three ivory
rods, 64 gold and silver disks) is amusing, though, in that it's an
example of using an "intractable" problem (moving the 64 rings by the
proper rules -- only stack on the immediate smaller size, only move
one at a time, and get the whole pile moved) to protect a "secret" (as
I've heard it, the world would be destroyed (or saved?) when the
operation was finished... perhaps the "secret" would be that it wasn't
going to work :-)

[how's that a desperate stretch for a cryptographic tie in?]

				_Mark_ <eichin at paycheck.cygnus.com>
				... just me at home ...







More information about the cypherpunks-legacy mailing list