Given n(=3) discs: disc1, disc2, disc3 stacked on the leftmost peg in order of size with the largest disc at the bottom and a disc is always smaller than the disc below.

Move all three (n) discs from left most Peg A to right most Peg C with the following rules:

Only one disc may be moved at a time.
A disc can not be placed on the top of a smaller disc.
There are only three pegs: A, B, C

Write the program to display every move and indicae the position of each disc:

Beginning position of three discs: (
A) (Position of disc 1, Position of disc 2, position of disc 3)
Disc 1 is smaller than disc 2 and disc 2 is smaller than disc 3.

Move disc 1 from Peg A to Peg C (

Move disc 2 from Peg A to Peg B (C, B, A)
Move disc 1 from Peg C to Peg B (B, B, A)
Last move
Move disc 1 from Peg A to Peg C (C, C, C)

Do the same for n=4 discs.

Do the same for n =5 discs.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.