Tower of Hanoi - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Tower of Hanoi

Description:

... the rings on the left-hand post to the right-hand post in the fewest possible moves. ... Sometimes you are asked to find the least number of moves it takes ... – PowerPoint PPT presentation

Number of Views:1249
Avg rating:3.0/5.0
Slides: 16
Provided by: mich76
Category:
Tags: hanoi | lefthand | tower

less

Transcript and Presenter's Notes

Title: Tower of Hanoi


1
Tower of Hanoi
  • Goal transfer all the rings on the left-hand
    post to the right-hand post in the fewest
    possible moves.
  • Rules
  • -you can only move one ring at a time
  • -you cannot put a larger ring on top of a smaller
    one
  • -moving a ring from one post to another is
    considered to be a move

2
Recursive Formula2tn-11
  • Sometimes you are asked to find the least number
    of moves it takes a certain number of rings to be
    transferred from one post to another.
  • To make it easier to find the least number of
    moves we suggest using the recursive formula.
  • A recursive formula is a formula based on the
    previous answer or number of moves.

3
Recursive pattern
  • Number of disks 1, number of moves 1
  • Number of disks 2, number of moves3
  • Example with one ring

4
Example with two rings
5
Congratulations!
  • Based on what you just did you now know that it
    takes exactly one move to move one ring and that
    it takes three moves to move two rings.

6
Recursive pattern
  • Now try to plug 3 in the formula to find the
    number of moves it takes to move three rings.
  • 2(3)17 moves
  • The formula tells us that it will take us at
    least 7 moves to transfer three rings to the
    other end (or post). Lets test it!

7
Example with three rings
8
Explanation of the formula
  • Now that you know that the formula works you
    might want to know why it works.
  • The formula is 2tn-11
  • It means that you time the previous number by two
    then add one to it.

9
Explanation of the formula
  • It takes three moves to move two rings to the
    middle post. (or post B)

10
Explanation of the formula
  • What we just did in the previous slide represents
    tn-1.
  • tn-1 means the previous number of moves which is
    three in this case.
  • It took us three moves to move the first two
    rings to the middle.

11
Explanation of the formula
  • The next thing you do when you have the two first
    rings in the middle is moving the last ring to
    opposite end.
  • That is where you get 1 in the formula, by
    moving the extra ring to the other end.

12
Explanation of the formula
  • The last thing to do after moving that ring is
    to move the remaining two to the opposite post.

13
Explanation of the formula
  • This is where the 2tn-1 comes from. It takes
    three moves to move the two first rings to post B
    and three moves again to move them to post C. So
    since you do the exact same thing twice, you can
    multiply that thing by 2.

14
Conclusion
  • The recursive formula helps you to find the
    least number of moves and it is based on the
    previous moves.
  • The formula works by plugging in your previous
    number of moves.

15
This presentation has been done
  • By Onnie K.
  • Michael O.
Write a Comment
User Comments (0)
About PowerShow.com