Skip to content

It is a Mathematical Puzzle , in which you take objects from the given tower to the destination Tower

License

Notifications You must be signed in to change notification settings

clickable-ops/Tower-Of-Hanoi-Solutions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tower-Of-Hanoi

It is a Mathematical Puzzle , in which you take objects from the given tower to the destination Tower

Welcome to the Tower-Of-Hanoi-Solutions


TOWER OF HANOI SOLUTIONS { A Program To Find Solutions Of A TOH Problem }


Tower Of Hanoi(TOH)

TOH ( also called the Tower of Brahma or Lucas' Tower) is a mathematical Quiz.It consists of three rods and a number of disks of different sizes, which can slide onto any rod. So basically , The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, means making the conical shape ..


The Objective of TOH is to move the entire STACK to another rod

Following Rules are to be followed

  • One disks move at a time.
  • Each move will consist of taking the upper disk from one of the stacks and placing it on the top of another stack or on an empty rod.
  • No smaller disk placed below the bigger one.

We can find that in how many minimum moves of disks we can get the solution Like for disks == 3 ,
We require minimum 7 moves to get the solution.

So the Formula is (2^n - 1) where n : Number of the disks..


For program you must a basic Knowledge of :--

  • Recursive Function

  • Python


Recursive Function

A recursive function is a function which either calls itself or is in a potential cycle of function calls. And a Immediate recursive function is that in which function calls itself directly

A recursive function has the following general form :--


ReturnType Function( Pass appropriate arguments ) {

if a simple case, return the simple value // base case / stopping condition

else call function with simpler version of problem }


For a recursive function to stop calling itself we require some type of stopping condition. If it is not the base case, then we simplify our computation using the general formula.

One can view this mathematically in a directed call graph.


void A() {

 A(); 

return;

}


  • Here is the 'Demonstration' of the 'Tower Of Hanoi' , How it works

  • Take an example of 3 Disks

tower_of_hanoi_4

  • Have questions in your mind about the TOH

tower_of_hanoi_5

  • ...Then comment or do chat with me at Join the chat at https://gitter.im/Reaction-Timer/Lobby

Procedure to run the Program


  • First run the code in the Python IDE
  • then the Program asks you to take input of no. of disks
  • Simply give input ..
  • It will shoe you the result and the algorithm
  • It also show that which disks you have to move and to which tower it has to move

Start the Repository 👍

Contact

Let's Become Friend

About

It is a Mathematical Puzzle , in which you take objects from the given tower to the destination Tower

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 17.3%
  • C++ 16.4%
  • COBOL 11.5%
  • C# 9.8%
  • Python 9.3%
  • Java 8.6%
  • Other 27.1%