Hosi
Hosi

Reputation: 545

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

Upvotes: 3

Views: 279

Answers (1)

MK.
MK.

Reputation: 34517

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.

Upvotes: 6

Related Questions