The best programmers are not marginally better than merely good ones. They are an order-of-magnitude better, measured by whatever standard: conceptual creativity, speed, ingenuity of design, or problem-solving ability. Randall E. Stross

Towers of Hanoi

Language Java | Level Intermediate | Category Algorithms | August 3, 2015 9:58 am


Algorithm Problem Description

Tower Of Hanoi is a mathematical game. It consists of three rods and disks with different size (small, medium and large). The objective of the puzzle is to move the entire stack to another rod. It should follow (1) Only one disk can be moved at a time. (2) Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack (3) No disk may be placed on top of a smaller disk.

Write a program to implement Tower Of Hanoi is a mathematical game

Output

          	        
          	        

Number of Discs in Towers of Hanoi: 3
Solution of Towers of Hanoi: 3
A -> C
A -> B
C -> B
A -> C
B -> A
B -> C
A -> C

          	        
          	        				    


Comments



Please login to add comments.