
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Problem. (a) How many bit strings of length 7 contain a substring of the form 100? (b) How many bit strings of length 7 contain a substring of the form 101?
COMMENT: There are only 2^7 = 128 bit strings of length 7, so one way to approach these problems would be to list all 128 of these and then cross out those that don’t satisfy (a) or (b). Please don’t solve the problem this way.
ANSWERS:
(a) The number of bit strings of length 7 that contain a substring of the form 100 is 74: Let A be the set of all such bit strings of length 7. Then
A = A 1 ∪ A 2 ∪ A 3 ∪ A 4 ∪ A 5
where Ai is the set of all bit strings of length 7 which have the first occurence of 100 starting in position i. Then |A 1 | = 2^4 , |A 2 | = 2^4 , |A 3 | = 2^4 , |A 4 | = 2^4 − 2 and |A 5 | = 2^4 − 4. Since the five subsets are pairwise disjoint, the sum principle gives that
|A| = 2^4 + 2^4 + 2^4 + (2^4 − 2) + (2^4 − 4) = 74.
(b) The number of bit strings of length 7 that contain a substring of the form 101 is 63. Here we can reduce the problem to computing the sums of the cardinalities of five subsets similar to (a), and the respective orders of these subsets are 2^4 , 2^4 , 2^4 − 4, 2^4 − 6 and 2^4 − 7.