The towers of Hanoi revisited: Moving the rings by counting the moves |
| |
Authors: | T.R. Walsh |
| |
Affiliation: | Dept. of Computer Science, University of Western Ontario, London, Ontario, N6A 3K7 Canada |
| |
Abstract: | A non-recursive algorithm, distinct from the one already in the literature, is presented for solving the n-ring Towers of Hanoi problem in the minimum 2n?1 moves. In addition, a simple relation is found between the binary representation of k and the position of the rings after k moves, allowing either to be obtained from the other in O(n) operations. Thus the position of the rings can be effectively stored in a work of n bits. |
| |
Keywords: | Towers of Hanoi iterative algorithms |
本文献已被 ScienceDirect 等数据库收录! |
|