用递归和非递归两种办法计算Hanoi问题
摘要:递归方法就是通常的方法。非递归方法是:循环移动最小的盘子,然后再移动不包括最小盘子的两根杆上的盘子(比较大小),直到结束。根据移动盘子个数是奇数或偶数确定先移动到那个杆上,是123循环,还是321循环,详情见程序。// Hanoi.cpp : Defines the entry point for the console application.// #include "stdafx.h"#in...
阅读全文
posted @ 2004-11-26 17:18
浙公网安备 33010602011771号