hanoi问题
package datastructure.tree;
/**
* ******************************************
*Hanoi tower.
*
* @author Michelle Min MitchelleMin@163.com
* @date 2021-06-14
* ******************************************
*/
public class Hanoi {
/**
********************************
* Move a number of plates.
*
*
* @param paraSource
* The source pole.
* @param paraIntermediary
* The destination pole.
* @param paraDestination
* The destination pole.
* @param paraNumber
* The number of plates.
********************************
*/
public static void hanoi(char paraSource, char paraIntermediary, char paraDestination, int paraNumber){
if (paraNumber == 1){
System.out.println(paraSource + "->" + paraDestination + " ");
return;
}//Of if
hanoi(paraSource, paraDestination, paraIntermediary, paraNumber - 1);
System.out.println(paraSource + "->" + paraDestination + " ");
hanoi(paraIntermediary, paraSource, paraDestination, paraNumber - 1);
}//Of hanoi
/**
********************************
* The entrance of the program.
*
* @param args
*Not used now.
********************************
*/
public static void main(String[] args){
hanoi('a', 'b', 'c', 3);
}//Of main
}//Of class Hanoi