This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full 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(n1) + 1 T(1) = c And this one? f(n) = f(n1) + f(n2) 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 n1 + t n2 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 n1 + s n2 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 ndigit 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 n1  a n1 9a n1 a n = 10 n1  a n1 + 9a n1 = 10 n1  8a n1 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 n1 + c 2 a n2 + … + c k a nk + f(n) Ex. a n = 5a n1  6a n2 , 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

Click to edit the document details