The total number of strings of length less than or equal to , which are neither in nor in , is ________.
View worked solution
Answer: 44
We need to find the number of binary strings of length that are neither in nor in , where:
- (strings consisting of only s or only s)
- (strings starting with followed by any number of s, or starting with followed by any number of s)
Let be the total number of binary strings of length . We analyze the number of strings of length in for each :
| Length () | Total () | Strings | Strings | Union | Neither () |
|---|---|---|---|---|---|
| 0 | 1 | (1) | (0) | 1 | |
| 1 | 2 | (2) | (2) | 2 | |
| 2 | 4 | (2) | (2) | 4 | |
| 3 | 8 | (2) | (2) | 4 | |
| 4 | 16 | (2) | (2) | 4 | |
| 5 | 32 | (2) | (2) | 4 |
Summing the counts of "Neither" for all lengths :
Free practice · Your answers on this page are not saved.
