Professional Documents
Culture Documents
Approximate Date Is Wednesday 3/27: #17 On Homework
Approximate Date Is Wednesday 3/27: #17 On Homework
Approximate Date Is Wednesday 3/27: #17 On Homework
Friday 3/8
Spring 2019 10:50 – 12:05 pm
Questions on Homework?
Quiz on 6-1,6-2 today *Test#2 on 3.1-3.3, 6.1-6.3, 6.8, 7.1-7.2
Approximate date is Wednesday 3/27
Recall:
Section 6-3 Generalized Permutations and Combinations
From 6-2:
Permutation is ordering of r selections from n total distinct items
Combination is a set of r selections from n total distinct items
Now we consider number of sequences or sets from groups of like items (duplicates exist)
#17 on homework
What we are trying to figure out is how many sets of (n -1) dividers and (r) not distinct selections.
#18 on homework
Generalized Pigeonhole Principle: If k is a positive integer and n objects are placed into k boxes and n > k, then
n
at least one of the boxes will contain at least ⌈ ⌉ objects.
k
#11 on homework
Today:
Section 7-1 Recurrence Relations - Introduction
A recursive definition of a sequence specifies
1. Initial conditions These are the terms we need before the recurrence relation part can start
2. Recurrence relation This is a sequence where each term is defined in terms of previous terms
Example:
a0 = 0, a1 = 3 initial conditions
2an-1 - an-2 recurrence relation
an = 3n solution – a solution to a recurrence relation is a formula such that we can determine
elements without referring to previous elements.
n 0 1 2 3 4 ….n
2an-1 – an-2 0 3 2a1 – a0= 6 2a2 – a1 = 9 2a3 – a2 = 12 2an-1 – an-2
n 0 1 2 3 …. n
an 5,000 5,000 + 5,000(.04) 5,000(1.04) 5,000(1.04) an-1(1.04)
= 5,000(1.04) +5,000(1.04)(.04)= (1.04(1.04)
5,000(1.04)(1.04)
Example:
Let Sn denote the number of n-bit strings that do not contain the pattern 111. Develop a recurrence
relation for S0, S1, S2, S3 …..
Solution:
S0 is a 0-bit string, S1 is a 1-bit string, S2 is a 2-bit string, S3 is a 3-bit string…..Sn is an n-bit string
S0 is a 0-bit string: ( ) empty string only 1 string
S1 is a 1-bit string: 0, 1 2 strings
S2 is a 2-bit string: 00, 01, 10, 11 4 strings
S3 is a 3-bit string: 000, 001, 010, 100, 011, 101, 110, 111 7 strings
Patterns?
I can see that S3 = 7 which is the sum of S0 + S1 + S2
I can see that in S3 there are 4 strings that start with 0, 2 strings that start with 10 and 1 string that starts
with 11
Step 1:
Replace n with n-1: an-1 = an-2 + 3
Substitute expression for an-1 into an = an-1 + 3
an = [an-2 +3] + 3 or an = an-2 + 2*3
Step 2:
Replace n with n-2: an-2 = an-3 + 3
Substitute expression for an-2 into an-1 = an-2 + 2*3
an-1 = [an-3 +3] + 2*3 or an-1 = an-3 + 3*3
Step 3:
Remove the recursive terms
We can see that an = an-1 + 3 can be written an = an-k + k*3 where k is a nonnegative integer
We need to remove the subscript n-k. We can do this by letting k = n-1
an = an-(n-1) + (n-1)*3
an = a1+ (n-1)*3 we know that a1 is initial condition and a1 = 2
an = 2+ (n-1)*3