ArsDigita University
Month 2:
Discrete Mathematics  Professor Shai Simonson
Problem Set 3 – Recursion and Induction
1.
Solve the Chinese Rings Puzzle, also called the Patience Puzzle,
(
http://johnrausch.com/PuzzleWorld/patience.htm
).
This will prepare you for recursion,
recurrence equations, proofs by induction and graph representations.
2.
Consider the variation of the Towers of Hanoi Problem where you have four pegs instead
of three.
For simplicity you may assume that
n
is a power of two.
Sloppy Joe designs this
solution:
In order to move
n
disks from
From
to
To
, using
Using1
and
Using2
:
If
n
equals 1, then move a disk from
From
to
To,
otherwise do the three recursive steps:
Move
n/2
disks from
From
to
Using1
, using
To
and
Using2;
Move
n/2
disks from
From
to
To
, using
Using1
and
Using2;
Move
n/2
disks from
Using1
to
To
, using
From
and
Using2;
a.
Explain why Sloppy Joe’s solution does not work.
b.
Fruity Freddie suggests changing the second line:
Move
n/2
disks from
From
to
To
, using
Using1
and
Using2;
to
Move
n/2
disks from
From
to
To
, using
Using2
and
Using1;
Explain why the algorithm still does not work in general.
c.
Code the algorithms in Scheme and report what happens for
n
= 4, and
n =
8.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '09
 Recursion, Binary numeral system, Hanoi, Tower of Hanoi, Hanoi problem, recurrence equation

Click to edit the document details