Illinois Institute of Technology
Department of Computer Science
Solutions to Homework Assignment 3
CS 330 Discrete Structures
Spring Semester, 2008
1. Solve using recurrences and operator method.
(a) Page 458, Problem 28.
i. Find a recurrence relation for the number of ways to climb
n
stairs if the person climbing the
stairs can take one stair, or two, or three stairs at a time.
Let
a
n
be the number of ways to climb
n
stairs.
We can start by taking 1 stair then
n

1 stairs in
a
n

1
ways,
or
we can start with 2 stairs
then
n

1 stairs in
a
n

1
ways,
or
we can start with 3 stairs, then climb
n

3 stairs in
a
n

3
ways.
This gives us a recurrence relation.
a
n
=
a
n

1
+
a
n

2
+
a
n

3
for
n
≥
3
ii. What are the initial conditions?
a
0
= 1,
a
1
= 1,
a
2
= 2
iii. Operator method
a
n
+3

a
n
+2

a
n
+1

a
n
= 0
(
E
3

E
2

E

1) = 0
(
E

φ
1
)(
E

φ
2
)(
E

φ
3
)
a
n
=
αφ
1
n
+
βφ
2
n
+
γφ
3
n
.
iv. Solve for constants using initial conditions.
a
0
= 1
a
1
= 1
a
2
= 2
solve with cubic equation.
v. How many ways to climb a flight of eight stairs?
a
n
=
a
n

1
+
a
n

2
+
a
n

3
a
3
= 2 + 1 + 1 = 4
a
4
= 4 + 2 + 1 = 7
a
5
= 7 + 4 + 2 = 13
a
6
= 13 + 7 + 4 = 24
a
7
= 24 + 13 + 7 = 44
a
8
= 44 + 24 + 13 = 81
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
CS 330—Spring, 2008
2
Solutions to Homework Assignment 3
(b) Page 458, Problem 30.
i. Find a recurrence relation for the number of ternary strings (e.g.
0
,
1
,
2) that contain two
consecutive 0’s.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Reingold,EdwardM.
 Computer Science, Recurrence relation, Pallavolo Modena, Sisley Volley Treviso, Illinois Institute of Technology Department of Computer Science

Click to edit the document details