A theorem concerning the relation between the Towers of Hanoi and the binary numbers is proven in this paper. From this theorem, an algorithm for the Towers of Hanoi problem follows. The performance evaluations of all existing recursive and iteative algorithms for the Towers of Hanoi problem show that the above iterative algorithm is the most efficient one in terms of time and space. Finally, it is shown that the binary representation of numbers completely characterizes the status of allndiscs in each step.
展开▼