This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 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 = 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 = 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 CS 330Spring, 2008 2 Solutions to Homework Assignment 3 (b) Page 458, Problem 30....
View
Full
Document
This homework help was uploaded on 04/15/2008 for the course CS 330 taught by Professor Reingold,edwardm. during the Spring '08 term at Illinois Tech.
 Spring '08
 Reingold,EdwardM.
 Computer Science

Click to edit the document details