开发者

Hanoi specific problem

Suppose that there are 2*n disks, How could be Hanoi problem solved if odd numbers are disks on bar "A" and even disks are on bar "B"? please Let me know 开发者_如何学编程if more information is needed.

Thanks


move disk 1 onto disk 2 then move the resulting "proper" hanoi towner 1,2 onto disk 3 using the classic algorithm. Then move the proper tower 1,2,3 onto 4. Continue until you get the full proper tower, then use classic algorithm to move to the destination.

EDIT1:

Example (incomplete)

1   2
3   4
5   6   
.   .   .

    1
    2
3   4
5   6   
.   .   .

    1
    2
    4
5   6   3
.   .   .

    2
1   4   
5   6   3
.   .   .

1   4   2   
5   6   3
.   .   .

        1
    4   2   
5   6   3
.   .   .

        1
4       2   
5   6   3
.   .   .

This is curious because the last step is a little bit of an optimization; what I described would try to build 1-2-3-4-6 but we jump directly to building 1-2-3-4-5. This probably means something.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜