lec0406 - CS 173 Discrete Mathematical Structures Cinda...

This preview shows pages 1–8. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

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.

Unformatted text preview: CS 173: Discrete Mathematical Structures Cinda Heeren [email protected] Siebel Center, rm 2213 Office Hours: BY APPOINTMENT Cs173 - Spring 2004 CS 173 Announcements Exam #2… Cs173 - Spring 2004 CS 173 Recurrences Where did you see this before? T(n) = 2T(n/2) + n T(1) = c How about this one? T(n) = 2T(n-1) + 1 T(1) = c And this one? f(n) = f(n-1) + f(n-2) f(0) = 1, f(1) = 1 Merge Sort Towers of Hanoi Fibonacci #s Cs173 - Spring 2004 CS 173 Recurrences A train is defined to be an engine, followed by cars of two different kinds…long and short. Long cars are 2 units long, and short ones are 1. Examples: How many trains of length n are there? t n = t n-1 + t n-2 t = 1 t 1 = 1 We still don’t really know. Cs173 - Spring 2004 CS 173 Recurrences How many bit strings do not have 2 consecutive 0s? Examples: 01111010, 10, 10101 s n = s n-1 + s n-2 s 1 = 2 s 2 = 3 Cs173 - Spring 2004 CS 173 Recurrences A computer system considers a string of decimal digits a valid codeword if it contains an even number of 0s. Find a recurrence relation for a n , the number of valid n-digit codewords. Total # of codewords is sum of those starting with 0 and those starting with something else. How many start with 0? How many start with something else? 10 n-1 - a n-1 9a n-1 a n = 10 n-1 - a n-1 + 9a n-1 = 10 n-1 - 8a n-1 a 1 = 9 Cs173 - Spring 2004 CS 173 Recurrences We’ve seen a variety. Techniques for solving depend on the particular form of the recurrence. Linear Recurrences with Constant Coefficients a n = c 1 a n-1 + c 2 a n-2 + … + c k a n-k + f(n) Ex. a n = 5a n-1 - 6a n-2 , a 0 = 0, a 1 = 1 “order k” Given any k consecutive values, a unique solution exists....
View Full Document

• Spring '08
• [email protected]
• Recurrence relation, Discrete Mathematical Structures, Siebel Center, Cinda Heeren

Page1 / 21

lec0406 - CS 173 Discrete Mathematical Structures Cinda...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online