The Tower Of Hanoi Edouard Lucas - 1883.

Slides:



Advertisements
Similar presentations
1 A B C
Advertisements

3.6 Support Vector Machines
We need a common denominator to add these fractions.
Multiplication Facts Review. 6 x 4 = 24 5 x 5 = 25.
27  9 =.
Year 5 Term 3 Unit 6b Day 1.
Patterns and sequences We often need to spot a pattern in order to predict what will happen next. In maths, the correct name for a pattern of numbers is.
The 5S numbers game..
Discrete Math Recurrence Relations 1.
Factoring Quadratics — ax² + bx + c Topic
Tower of Hanoi Tower of Hanoi is a mathematical puzzle invented by a French Mathematician Edouard Lucas in The game starts by having few discs stacked.
The Towers of Hanoi or Apocalypse When?.
CS1010: Programming Methodology
By Katie Dzerovych Jon Wood JB Henderson Mentor Professor Snapp.
Chapter 8 Recursion. 8.1 Recursively Defined Sequences.
Fibonacci Numbers and Binet Formula (An Introduction to Number Theory)
Introduction to Algorithms
More Recursion: Permutations and Towers of Hanoi COP 3502.
AE1APS Algorithmic Problem Solving John Drake
Analyzing Algorithms and Problems Prof. Sin-Min Lee Department of Computer Science.
Data Structures and Algorithms
The Tower of Hanoi Ben Epstein Special Topics 2003.
Recursion.
Review of Recursion. Definition: Recursion - The process of a function calling itself.
The Tower of Hanoi
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 16: Recursion.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
I can identify and extend patterns in sequences and represent sequences using function notation. 4.7 Arithmetic Sequences.
Chapter 8 With Question/Answer Animations 1. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Introduction to Programming (in C++) Recursion Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC.
Copyright © Cengage Learning. All rights reserved.
CSc /6 Week nine 1 CSc142 Algorithms and efficiency Week 9 Pete Bagnall Elizabeth Phillips
Advanced Counting Techniques
Towers of Hanoi. Introduction This problem is discussed in many maths texts, And in computer science an AI as an illustration of recursion and problem.
Analysis of Algorithm Lecture 3 Recurrence, control structure and few examples (Part 1) Huma Ayub (Assistant Professor) Department of Software Engineering.
25-2 Recursive Functions Related Chapter: ABC 5.14, 5.15.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
13.2 Recursive Definitions Objective 1) Provide the recursive definition for sequences; 2) Identify the type of a sequence from a recursive definition.
Recursion Jordi Cortadella Department of Computer Science.
# 1# 1 VBA Recursion What is the “base case”? What is the programming stack? CS 105 Spring 2010.
Whiteboardmaths.com © 2004 All rights reserved
Thought Experiment Take a piece of paper one thousandth of an inch thick Now fold it in half and then in half again Do this 50 times (I know that this.
Informal Analysis of Merge Sort  suppose the running time (the number of operations) of merge sort is a function of the number of elements to sort  let.
Java Programming: Guided Learning with Early Objects Chapter 11 Recursion.
Upon completion, the world will end…
Chapter 6.1: Recurrence Relations Discrete Mathematical Structures: Theory and Applications.
 STACK STACK  STACK OPERATIONS STACK OPERATIONS  PUSH ALGORITHM PUSH ALGORITHM  POP ALGORITHM POP ALGORITHM  USES OF STACK USES OF STACK  THE TOWER.
22C:19 Discrete Math Advanced Counting Fall 2010 Sukumar Ghosh.
Recursion Colin Capham Recursion – an introduction to the concept.
Discrete Mathematics Lecture # 22 Recursion.  First of all instead of giving the definition of Recursion we give you an example, you already know the.
UNIT 17 Recursion: Towers of Hanoi.
1 In this puzzle, the player begins with n disks of decreasing diameter placed one on top of the other on one of three pegs of the game board. The player.
Tower of Hanoi Tower of Hanoi is a mathematical puzzle invented by a French Mathematician Edouard Lucas in The game starts by having few discs stacked.
Recursively Defined Sequences Lecture 40 Section 8.1 Wed, Apr 11, 2007.
Recursion by Ender Ozcan. Recursion in computing Recursion in computer programming defines a function in terms of itself. Recursion in computer programming.
INTRO2CS Tirgul 6. Understanding the Traceback # in file t.py: def a(L): return b(L) def b(L): return L.len() #should have been len(L) # in the python.
Recursion (Continued)
Recursion.
Pramada Ramachandran, Assistant Professor, Department of Mathematics,
Introduction to Recurrence Relations
School of EECS, Peking University
Whiteboardmaths.com © 2004 All rights reserved
Jordi Cortadella Department of Computer Science
Copyright © Cengage Learning. All rights reserved.
ECE 103 Engineering Programming
When Will The World End “Temple of Brahma” legend from the Indian city of Benares Priests must move 64 gold disks from one end of the temple to the other.
Copyright © Cengage Learning. All rights reserved.
Write the recursive and explicit formula for the following sequence
Problem Solving WEEK 3.
Presentation transcript:

The Tower Of Hanoi Edouard Lucas - 1883

Once upon a time! The Tower of Hanoi (sometimes referred to as the Tower of Brahma or the End of the World Puzzle) was invented by the French mathematician, Edouard Lucas, in 1883. He was inspired by a legend that tells of a Hindu temple where the pyramid puzzle might have been used for the mental discipline of young priests.

What does legend say?? Legend says that at the beginning of time the priests in the temple were given a stack of 64 gold disks, each one a little smaller than the one beneath it. Their assignment was to transfer the 64 disks from one of three poles to another, with one important proviso a large disk could never be placed on top of a smaller one. The priests worked very efficiently, day and night. When they finished their work, the myth said, the temple would crumble into dust and the world would vanish. How many moves ( & how long) would the priests need to take to complete the task??

Start here - Instructions 1. Transfer all the disks from one pole to another pole. 2. You may move only ONE disk at a time. 3. A large disk may not rest on top of a smaller one at any time. What is the shortest number of moves the priests would need to take to move 64 disks and how long would it take, if they moved them at a rate of one disk per second? 1 2 3 A B C

Shortest number of moves?? Try this one! 1 2 3 4 A B C Shortest number of moves??

Shortest number of moves?? And this one 1 2 3 4 5 A B C Shortest number of moves??

Shortest number of moves?? Now try this one! 1 2 3 4 5 6 A B C Shortest number of moves??

Where's the maths in this game? From the moves necessary to transfer one, two, and three disks, we can find a recursive pattern - a pattern that uses information from one step to find the next step. Unfortunately, if we want to know how many moves it will take to transfer 64 disks from post A to post C, we will first have to find the moves it takes to transfer 63 disks, 62 disks, and so on. Therefore the recursive pattern will not be much help in finding the number of moves or the time it would take to transfer all the disks.

However, the recursive pattern can help us generate more numbers to find an explicit (non-recursive) pattern. Here's how to find the number of moves needed to transfer larger numbers of disks from post A to post C, when M = the number of moves needed to transfer n-1 disks from post A to post C: for 1 disk it takes 1 move to transfer 1 disk from post A to post C; for 2 disks, it will take 3 moves: 2M + 1 = 2(1) + 1 = 3 for 3 disks, it will take 7 moves: 2M + 1 = 2(3) + 1 = 7 for 4 disks, it will take 15 moves: 2M + 1 = 2(7) + 1 = 15 for 5 disks, it will take 31 moves: 2M + 1 = 2(15) + 1 = 31 for 6 disks... ?

Explicit Pattern Number of Disks Number of Moves 1 1 2 3 3 7 4 15 5 31 1 1 2 3 3 7 4 15 5 31 6 63

Powers of two help reveal the pattern: Number of Disks (n) Number of Moves 1 21 - 1 = 2 - 1 = 1 2 22 - 1 = 4 - 1 = 3 3 23 - 1 = 8 - 1 = 7 4 24 - 1 = 16 - 1 = 15 5 25 - 1 = 32 - 1 = 31 6 26 - 1 = 64 - 1 = 63

Fascinating fact So the formula for finding the number of steps it takes to transfer n disks from post A to post C is: 2 n - 1 The number of separate transfers of single disks the priests must make to transfer the tower is 2 to the 64th minus 1, or 18,446,744,073,709,551,615 moves! If the priests worked day and night, making one move every second it would take slightly more than 580 billion years to accomplish the job! - far, far longer than some scientists estimate the solar system will last.

The Tower Of Hanoi