Try the fastest way to create flashcards
Question

# If $\alpha$ is a bit string, let $C(\alpha)$ be the maximum number of consecutive 0’s in $\alpha$. [Examples: $C(10010) = 2, C(00110001) = 3$.] Let $S_n$ be the number of n-bit strings $\alpha$ with $C(\alpha) \leq 2$. Develop a recurrence relation for $S_1, S_2, . . . .$

Solution

Verified
Step 1
1 of 2

Given:

$\alpha$ is a bit string

$C(\alpha)$=maximum number of consecutive 0's in $\alpha$

$S_n$ number of $n$-bit strings $\alpha$ with $C(\alpha)\leq 2$

When $\alpha$ is an $n$-bit string with at most 2 consecutive zeros and $n\geq 3$, then $\alpha$ either ends with 1 or with 10 or with 100 (as $\alpha$ has at most two consecutive zeros).

When $\alpha$ ends with 1, then there are $S_{n-1}$ possible strings for the remaining $n-1$ digits and thus there are $S_{n-1}$ strings $\alpha$ that end with 1.

When $\alpha$ ends with 10, then there are $S_{n-2}$ possible strings for the remaining $n-2$ digits and thus there are $S_{n-2}$ strings $\alpha$ that end with 10.

When $\alpha$ ends with 100, then there are $S_{n-3}$ possible strings for the remaining $n-3$ digits and thus there are $S_{n-3}$ strings $\alpha$ that end with 100.

In total, there are thus $S_{n-1}+S_{n-2}+S_{n-3}$ $n$-bit strings with at most two consecutive zeros (when $n\geq 3$).

$S_n=S_{n-1}+S_{n-2}+S_{n-3}$

There are 2 1-bit strings that contain at most 2 consecutive zeros: 0 and 1.

$S_1=1$

There are 4 2-bit strings that contain at most 2 consecutive zeros: 00, 01, 10, 11.

$S_2=4$

There are 7 3-bit strings that contain at most 2 consecutive zeros: 001, 010, 011, 100, 101, 110, 111.

$S_3=7$

## Recommended textbook solutions #### Discrete Mathematics and Its Applications

7th EditionISBN: 9780073383095 (8 more)Kenneth Rosen
4,283 solutions #### Discrete Mathematics

8th EditionISBN: 9780321964687Richard Johnsonbaugh
4,246 solutions #### Discrete Mathematics and Its Applications

8th EditionISBN: 9781259676512 (3 more)Kenneth Rosen
4,397 solutions #### Discrete Mathematics with Applications

5th EditionISBN: 9781337694193Susanna S. Epp
2,641 solutions