Let be the number of -bit strings that do NOT contain two consecutive . Which one of the following is the recurrence relation for ?
View worked solution
Answer: B
To find the recurrence relation for , the number of -bit strings that do not contain two consecutive 's, we can analyze the possible endings of a valid -bit string:
- Case 1: The string ends with .
If the last bit is , the preceding bits can be any valid string of length that does not contain consecutive 's. There are such strings. - Case 2: The string ends with .
If the last bit is , the second-to-last bit must be to avoid consecutive 's (i.e., the string must end in ). The preceding bits can be any valid string of length that does not contain consecutive 's. There are such strings.
Since these two cases are mutually exclusive and cover all valid -bit strings, we sum them to get the total number of strings:
Verification with small values:
- For , the valid strings are , so .
- For , the valid strings are , so .
- For , the valid strings are , so .
Using the recurrence relation: , which matches our count.
Free practice · Your answers on this page are not saved.
