汉诺塔-算法实现
来源:互联网 发布:单片机串口通讯实验 编辑:程序博客网 时间:2024/06/11 04:35
使用递归方法来实现经典算法问题<汉诺塔问题>。
下面是本人的代码:
// 汉诺塔.cpp : Defines the entry point for the console application.
//将A中的圆块移动到C中。
#include "stdafx.h"
#include<stdio.h>
void move(char,char);
void move(char,char);
void main()
{
int m;
printf("input the number of disks:");
scanf("%d",&m);
printf("the step to moving %3d diskes:/n",m);
hanoi(m,'A','B','C');
}
void move(char x,char y)
{
printf("%c-->%c/n",x,y);
}
void hanoi(int n,char one ,char two,char three)
{
if(n==1)
move(one,three);
else
{
hanoi(n-1,one,three,two);
move(one,three);
hanoi(n-1,two,one,three);
}
}
- 汉诺塔的实现算法
- 汉诺塔-算法实现
- 汉诺塔算法及实现
- java实现汉诺塔算法
- 汉诺塔游戏算法实现
- Python 实现汉诺塔算法
- 汉诺塔递归算法实现
- 算法----汉诺塔的递归实现
- 汉诺塔(hanoi)算法实现
- 用Swift实现汉诺塔算法
- python实现算法题-汉诺塔
- 使用递归算法实现汉诺塔
- 汉诺塔递归算法实现 c++
- 算法实现
- 算法实现
- 算法和算法实现
- 【数据结构与算法】汉诺塔算法——java递归实现
- 算法笔记:使用栈实现汉诺塔(Hanoi)经典算法
- http://acm.hdu.edu.cn/showproblem.php?pid=2441 犀利的证明
- 基于Web的应用系统开发中应该重点注意的几个问题
- HTML5 - 存储和新元素
- sql语句大全
- sql字符截取-传递到 SUBSTRING 函数的长度参数无效
- 汉诺塔-算法实现
- 纪念9.18勿忘国耻!!
- iis配置
- 判断是否为完全平方数
- java初学者
- 减小Lazarus编译的可执行文件的体积
- C++中函数指针详解
- CSDN数据库不稳定?
- return 语句