Modified Towers of Hanoi with 5 pegs n disks

巧了我就是萌 提交于 2020-01-06 06:34:26

问题


My Question is that I have a Tower of Hanoi with 5 pegs but movement is limited to

Start -> Aux1 <-> Aux2 <-> Aux3 -> Destination

  1. Start can only move out
  2. Only Aux1, Aux2, Aux3 can exchange disks
  3. Once a disk arrive Destination, it cannot go back

How can I expand the algorithm from 3 peg to 5 peg version with n disks?

n = 1:

  • Aux1 -> Aux2
  • Aux2 -> Aux3

n >= 2 :

  • Hanoi(Aux1,Aux2,Aux3,n-1)
  • Aux1 -> Aux2
  • Hanoi(Aux3,Aux2,Aux1,n-1)
  • Aux2 -> Aux3
  • Hanoi(Aux1,Aux2,Aux3,n-1)

来源:https://stackoverflow.com/questions/48724815/modified-towers-of-hanoi-with-5-pegs-n-disks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!