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)
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.