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,
A,
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 (
C,
A,
A)

Move disc 2 from Peg A to Peg B (C, B, A)
Move disc 1 from Peg C to Peg B (B, B, A)
Etc...
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. Posted solutions are meant to be 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 complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.