Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#83 - Restricted Tower of Hanoi #13

Open
NickWarm opened this issue Dec 21, 2016 · 1 comment
Open

#83 - Restricted Tower of Hanoi #13

NickWarm opened this issue Dec 21, 2016 · 1 comment
Assignees
Labels

Comments

@NickWarm
Copy link
Collaborator

NickWarm commented Dec 21, 2016

英文

There are n disks of different sizes and three pegs. Initially, all the disks are on the first peg in order of size, the largest on the bottom and the smallest on top. The object is to transfer all the disks to the third peg. Only one disk can be moved at a time, and it is forbidden to place a larger disk on top of a smaller one. In addition, any move should either place a disk on the middle peg or move a disk from that peg (Figure 2.19). Design an algorithm that solves the puzzle in the minimum number of moves.

中文

有n個不同的小的盤子和3根柱子。最初,所有的盤子都按大小順序放置在第一根柱子上面,最大的在最下面,最小的在最上面。現在想要將所有的盤子都移動到第三根柱子上面去。一次只能移動一個盤子,而且禁止將大盤子放在小盤子上面。此外,每次移動要麽在中間柱子上面放置一個盤子,要麼從中間柱子上面取走一個盤子,如圖2.19所示,請設計一個演算法解決此問題,使得所使用的移動次數最小

提示

用遞迴解

@NickWarm NickWarm changed the title #83 - RestrictedTowerofHanoi #83 - Restricted Tower of Hanoi Dec 24, 2016
@NickWarm
Copy link
Collaborator Author

昨天的投影片與程式碼,我已經放到我的GitHub上面去了:tower_of_hanoi_ruby

@NickWarm NickWarm reopened this Dec 27, 2016
@NickWarm NickWarm added the Done label Dec 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants