SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
Tower of Hanoi
(Application Of Stacks)
-Vinit Dantkale
 The Tower of Hanoi puzzle was invented by the French mathematician
Edouard Lucas in 1883.
 Tower Of Hanoi is a Puzzle involving the usage of Stacks.
 Shifting of discs from source tower to target tower.
 Rules for solving puzzle:
1. One disc can be shifted at once.
2. Only top disc can be shifted.
3. Large disc cannot be placed on smaller disc.
4. Only 3 stacks can be used for solving the puzzle.
Source Tower having N discs can be solved using (2^N)-1 moves.
Introduction
Usage of Stacks in Tower of Hanoi:
Real life analogy of Stack ie. Access single disc, Single Access location.
Steps:
1. Move 1 from A to C
2. Move 2 from A to B
3. Move 1 from C to B
4. Move 3 from A to C
5. Move 1 from B to A
6. Move 2 from B to C
7. Move 1 from A to C
Use of Recursion for algorithm:
Explanation:
• The recursion used before
"movedisk" is to move all
but the bottom disk on the
initial tower to an
intermediate pole.
• The next line simply
moves the bottom disk to
its final resting place.
• Then on line we move the
tower from the
intermediate pole to the
top of the largest disk.
• The base case is detected
when the tower height is 0
and the base of the tower
is moved Use of recursion is again use of stack
Application:
 Used as Backup rotation Scheme (Backups of Computers
having multiple tapes/media)
A backup rotation scheme is a system for managing your
backup storage media (tapes/DVDs/HDDs).
 Used by neuropsychologists trying to evaluate frontal lobe
deficits.
 Used to Solve mathematical problems related to Hamilton
Cycle.
Other possible data structures:
 Puzzles are connected with graphs, it means can be modeled by
using graphs.
 Other possible data structure used for this puzzle is Undirected
Graph.
 Vertices of the graph represent configuration and graph edges
define possible moves of the puzzle.
For Tower with Height as 2
References:
http://interactivepython.org/runestone/static/pythonds/Recursion/TowerofHanoi.html
https://www.igi-global.com/chapter/the-application-of-hanoi-towers-game-in-
logistics-management/145640
Thank You
-----End of Presentation----

More Related Content

PPTX
Tower of hanoi
PPTX
Tower of hanoi
PPTX
Data Structure and Algorithms The Tower of Hanoi
PDF
Tourist behaviour, unit 2
PPTX
File handling in Python
PPTX
CRLA Scoresheets.pptx
PPTX
Satellite networks
PPTX
Doubly Linked List || Operations || Algorithms
Tower of hanoi
Tower of hanoi
Data Structure and Algorithms The Tower of Hanoi
Tourist behaviour, unit 2
File handling in Python
CRLA Scoresheets.pptx
Satellite networks
Doubly Linked List || Operations || Algorithms

What's hot (20)

PPTX
Tower Of Hanoi -A MatheMatical PuZzle
PPTX
Tower of Hanoi
PPTX
heap Sort Algorithm
PPTX
Data structure - Graph
PPTX
Quick sort
PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
PPTX
single linked list
PPTX
Graph traversals in Data Structures
PPTX
Priority queue in DSA
PPTX
Priority Queue in Data Structure
PPT
Spanning trees
PPTX
Doubly Linked List
PPTX
Queue in Data Structure
PPTX
Algorithm Complexity and Main Concepts
PPT
PPTX
Hashing Technique In Data Structures
PPT
Asymptotic notations
PPTX
Asymptotic Notation
PDF
Array data structure
PPT
Data Structures- Part5 recursion
Tower Of Hanoi -A MatheMatical PuZzle
Tower of Hanoi
heap Sort Algorithm
Data structure - Graph
Quick sort
Data Structures - Lecture 9 [Stack & Queue using Linked List]
single linked list
Graph traversals in Data Structures
Priority queue in DSA
Priority Queue in Data Structure
Spanning trees
Doubly Linked List
Queue in Data Structure
Algorithm Complexity and Main Concepts
Hashing Technique In Data Structures
Asymptotic notations
Asymptotic Notation
Array data structure
Data Structures- Part5 recursion
Ad

Similar to Tower Of Hanoi (20)

PPTX
TOWERS OF HANOI_problemsolutionandexplanationwithalgorithm.pptx
PPTX
Tower of Hanoi presentation
PDF
The Towers of Hanoi puzzle has three posts and some number n of disk.pdf
PPT
Towers Hanoi Algorithm
PDF
Tower of hanoi algorithm
PPTX
Tower of hanoi
PPTX
Tower of Hanoi Method
PPT
Tower of honoi using open source code python
PPTX
Tower of Hanoi
PPTX
Data structure lab
PDF
Rand final
PDF
Tower of Hanoi using AI technique - means ends analysis
PDF
Searching Informed Search.pdf
PPT
Queue (1)(1).ppt
PPTX
Control System Homework Help
PDF
module5_backtrackingnbranchnbound_2022.pdf
PPT
HEURISTIC SEARCH IN ARTIFICIAL INTELLEGENCE
PPT
What is A-Star (A*) Algorithm in Artificial astar.ppt
PDF
ADS_Lec1_Linear_lists_Stacks
PPTX
Deep learning (2)
TOWERS OF HANOI_problemsolutionandexplanationwithalgorithm.pptx
Tower of Hanoi presentation
The Towers of Hanoi puzzle has three posts and some number n of disk.pdf
Towers Hanoi Algorithm
Tower of hanoi algorithm
Tower of hanoi
Tower of Hanoi Method
Tower of honoi using open source code python
Tower of Hanoi
Data structure lab
Rand final
Tower of Hanoi using AI technique - means ends analysis
Searching Informed Search.pdf
Queue (1)(1).ppt
Control System Homework Help
module5_backtrackingnbranchnbound_2022.pdf
HEURISTIC SEARCH IN ARTIFICIAL INTELLEGENCE
What is A-Star (A*) Algorithm in Artificial astar.ppt
ADS_Lec1_Linear_lists_Stacks
Deep learning (2)
Ad

Recently uploaded (20)

PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Construction Project Organization Group 2.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PPT
Project quality management in manufacturing
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
web development for engineering and engineering
PPTX
Sustainable Sites - Green Building Construction
PPTX
Welding lecture in detail for understanding
PDF
Well-logging-methods_new................
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
DOCX
573137875-Attendance-Management-System-original
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Digital Logic Computer Design lecture notes
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
OOP with Java - Java Introduction (Basics)
Construction Project Organization Group 2.pptx
UNIT 4 Total Quality Management .pptx
Project quality management in manufacturing
CYBER-CRIMES AND SECURITY A guide to understanding
web development for engineering and engineering
Sustainable Sites - Green Building Construction
Welding lecture in detail for understanding
Well-logging-methods_new................
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
CH1 Production IntroductoryConcepts.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Geodesy 1.pptx...............................................
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Internet of Things (IOT) - A guide to understanding
573137875-Attendance-Management-System-original
Operating System & Kernel Study Guide-1 - converted.pdf
Digital Logic Computer Design lecture notes
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Model Code of Practice - Construction Work - 21102022 .pdf

Tower Of Hanoi

  • 1. Tower of Hanoi (Application Of Stacks) -Vinit Dantkale
  • 2.  The Tower of Hanoi puzzle was invented by the French mathematician Edouard Lucas in 1883.  Tower Of Hanoi is a Puzzle involving the usage of Stacks.  Shifting of discs from source tower to target tower.  Rules for solving puzzle: 1. One disc can be shifted at once. 2. Only top disc can be shifted. 3. Large disc cannot be placed on smaller disc. 4. Only 3 stacks can be used for solving the puzzle. Source Tower having N discs can be solved using (2^N)-1 moves. Introduction
  • 3. Usage of Stacks in Tower of Hanoi: Real life analogy of Stack ie. Access single disc, Single Access location. Steps: 1. Move 1 from A to C 2. Move 2 from A to B 3. Move 1 from C to B 4. Move 3 from A to C 5. Move 1 from B to A 6. Move 2 from B to C 7. Move 1 from A to C
  • 4. Use of Recursion for algorithm:
  • 5. Explanation: • The recursion used before "movedisk" is to move all but the bottom disk on the initial tower to an intermediate pole. • The next line simply moves the bottom disk to its final resting place. • Then on line we move the tower from the intermediate pole to the top of the largest disk. • The base case is detected when the tower height is 0 and the base of the tower is moved Use of recursion is again use of stack
  • 6. Application:  Used as Backup rotation Scheme (Backups of Computers having multiple tapes/media) A backup rotation scheme is a system for managing your backup storage media (tapes/DVDs/HDDs).  Used by neuropsychologists trying to evaluate frontal lobe deficits.  Used to Solve mathematical problems related to Hamilton Cycle.
  • 7. Other possible data structures:  Puzzles are connected with graphs, it means can be modeled by using graphs.  Other possible data structure used for this puzzle is Undirected Graph.  Vertices of the graph represent configuration and graph edges define possible moves of the puzzle. For Tower with Height as 2