数据结构与算法学习(9)
一.暴力递归
1.汉诺塔问题
void Process(int i, string from, string to, string other) {
if (i == 0)
return;
else {
Process(i - 1, from, other, to);
cout << "Move " + to_string(i) + " From " + from + " To " + to << endl;
Process(i - 1, other, to, from);
}
}
void Test01() {
Process(3, "左", "右", "中");
}