汉诺塔
上一篇 /
下一篇 2012-06-13 20:50:31
/ 个人分类:java
public class test1 {
static int numArr[];
//二分法查找
static void move(int value,char from, char iner, char to )
{
if(value==1)
{
System.out.println("move plane from 1" + from + " to "+to);
}
else
{
move( value-1, from,to, iner );
System.out.println("move plane from "+value + from + " to "+to);
move( value-1, iner,from,to );
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
numArr= new int[9];
move(3,'a', 'b', 'c' );
}
}
收藏
举报
TAG: