Tower of Hanoi in Java Using Recursion

What is Tower of Hanoi ?

Tower of Hanoi is also called as Tower of Brahma or Lucas Tower. It is one of the most popular problem which makes you understand the power of recursion.  Tower of Hanoi is a mathematical puzzle which consist of 3 poles and number of discs of different sizes. Initially all the discs will be places in the single pole with the largest disc at the bottom and smallest on the top. We need to move all the disc from the first pole to the third pole with the smallest disc at the top and the largest at the bottom under the below conditions

  1. Only one disc can be moved at a time.
  2. Larger disc cannot be placed on a smaller disc.

[Read more…]