If McDonalds were run like a software company, one out of every hundred Big Macs would give you food poisoning, and the response would be, ‘We’re sorry, here’s a coupon for two more.’ “ Mark Minasi

Tower Of Hanoi

Language Java | Level Intermediate | Category Data structure | August 30, 2015 1:33 pm

Data structure Description

Tower Of Hanoi is a mathematical game which consists three rods. The rods has a number of disk with the different size which can slide onto any rod. 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.>/li>

Write a program to implement Tower Of Hanoi which move the disks from source to destination using the stack.



Enter number of discs: 3
A -> C
A -> B
C -> B
A -> C
B -> A
B -> C
A -> C



No comments available!

Please login to add comments.