Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tower of Hanoi problem: Move the pile of rings from one peg to another

Similar presentations


Presentation on theme: "Tower of Hanoi problem: Move the pile of rings from one peg to another"— Presentation transcript:

1 Tower of Hanoi problem: Move the pile of rings from one peg to another
Moving one ring at a time No ring can be placed on top of a smaller ring A B C

2 Hanoi ( 4, 'A', 'B') A B C

3 Hanoi ( 1, 'A', 'B') A B C

4 Hanoi ( 1, 'A', 'C') A B C

5 Hanoi ( 2, 'A', 'B') Hanoi (1, 'A', 'C' ) move ring from 'A' to 'B' Hanoi(1, 'C', 'B' ) A B C

6 Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C

7 Hanoi ( 4, 'A', 'B') Hanoi (3, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 3, 'C', 'B') Hanoi ( n, x, y) Hanoi (n-1, x, z) move ring from x to y Hanoi ( n-1, z, y) A B C


Download ppt "Tower of Hanoi problem: Move the pile of rings from one peg to another"

Similar presentations


Ads by Google