Skip to content

[FEATURE REQUEST] Adding "TOWER OF HANOI" to Recursion File #7223

@justanothercoder-hub

Description

@justanothercoder-hub

What would you like to Propose?

I would like to add the problem "Tower of Hanoi" to recursion file. I think its a great beginner application of the recursion concept.

Issue details

**The Core Rules
1.Only one disk can be moved at a time.

2.A disk can only be moved if it is the uppermost disk on a stack.

3.No larger disk may be placed on top of a smaller disk.**

The Stepped Algorithm (Recursive)
To move $n$ disks from a Source peg to a Destination peg using an Auxiliary (helper) peg, follow these three logical steps:
Step 1: Move the top $n-1$ disks from the Source peg to the Auxiliary peg. (This clears the path for the largest disk).
Step 2: Move the remaining largest disk directly from the Source peg to the Destination peg
.Step 3: Move the $n-1$ disks that were sitting on the Auxiliary peg to the Destination peg. (Placing them on top of the largest disk).

Additional Information

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions