![]() Then move the top disc to the spare peg, make the next legal move(nittd). if odd, move the first disc to the destination peg, make the next legal move (not involving the top disc). ![]() Then move the top disc to the source peg, make the next legal move(nittd). Then move the top disc to the destination peg, make the next legal move(nittd). if even, move the first disc to the spare peg, make next legal move (not involving the top disc).Incidently, to solve the problem by hand is quite satisfying. ![]() The solution also conveys the power of proof by induction and a warm glow to all programmers who have wrestled with conventional control structures. However it is the displaying of the function parameters which is the solution to the problem and crucially understanding the double tree like structure of the calls.
0 Comments
Leave a Reply. |