Professional Documents
Culture Documents
1. Give the generating function for the set S of {0, 1}-strings which do not contain the substring 11.
Solution. This is Problem 1.33 on Page 48 of the course notes. The solution presented there uses the
0-decomposition. We will use the block decomposition here.
To derive a decomposition which uniquely creates the elements of S, we modify the block decompo-
sition:
{0, 1}∗ = {0}∗ ({1}{1}∗ {0}{0}∗ )∗ {1}∗ .
|{z} | {z } | {z } |{z}
A B C D
In each of the four sets, A, B, C, D, we determine which strings we must remove so that the substring
11 is never created:
2. Give the generating function for the set T of {0, 1}-strings which do not contain the substring 11 and
do not begin and end with distinct 1’s (for example, 1, 010, 100, 001 ∈ T but 110, 101 6∈ T ).
Notice that if we take any string in T and bend it into a circle, the substring 11 will never occur.
This is not true of all the strings in S.
We will solve this problem in two different ways.
Solution 1. Notice that T ⊂ S; that is, every string in T is also in S, but there are some strings in
S that are not in T . This suggests that we may be able to determine a decomposition of T of the
form S \ A.
Any string in S that begins and ends with distinct 1’s must be removed. We certainly must remove
all the strings in the set {10}S{01}. Further, if σ ∈ S has length 4 or greater and begins and ends
with distinct 1’s, then σ ∈ {10}S{01}. As for strings of length 3 or less, there is only one such string
in S that must be removed, namely 101. So we see that
T = S \ ({10}S{01} ∪ {101}).
1
Using this decomposition, we can compute ΦT (x) as a function of ΦS (x):
So, we must consider the strings of length 2 or less that are in T but are not contained in any of
{0}S{0}, {0}S{01}, {10}S{0}. The strings we are missing are , 0, 1, 01, 10. Thus, we see that