Download presentation
Presentation is loading. Please wait.
Published byAleksandra Smolińska Modified over 6 years ago
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 ( 4, 'A', 'B') A B C
4
Hanoi ( 1, 'A', 'B') A B C
5
Hanoi ( 1, 'A', 'B') A B C
6
Hanoi ( 1, 'A', 'C') A B C
7
Hanoi ( 1, 'A', 'C') A B C
8
Hanoi ( 2, 'A', 'B') Hanoi (1, 'A', 'C' ) move ring from 'A' to 'B' Hanoi(1, 'C', 'B' ) A B C
9
Hanoi ( 2, 'A', 'B') Hanoi (1, 'A', 'C' ) move ring from 'A' to 'B' Hanoi(1, 'C', 'B' ) A B C
10
Hanoi ( 2, 'A', 'B') Hanoi (1, 'A', 'C' ) move ring from 'A' to 'B' Hanoi(1, 'C', 'B' ) A B C
11
Hanoi ( 2, 'A', 'B') Hanoi (1, 'A', 'C' ) move ring from 'A' to 'B' Hanoi(1, 'C', 'B' ) A B C
12
Hanoi ( 2, 'A', 'B') Hanoi (1, 'A', 'C' ) move ring from 'A' to 'B' Hanoi(1, 'C', 'B' ) A B C
13
Hanoi ( 2, 'A', 'B') Hanoi (1, 'A', 'C' ) move ring from 'A' to 'B' Hanoi(1, 'C', 'B' ) A B C
14
Hanoi ( 2, 'A', 'B') Hanoi (1, 'A', 'C' ) move ring from 'A' to 'B' Hanoi(1, 'C', 'B' ) A B C
15
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
16
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
17
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
18
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
19
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
20
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
21
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
22
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
23
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
24
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
25
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
26
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
27
Hanoi ( 3, 'A', 'B') Hanoi (2, 'A', 'C') move ring from 'A' to 'B' Hanoi ( 2, 'C', 'B') A B C
28
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
29
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
30
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
31
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.