retagged by
697 views
1 votes
1 votes

A bit string is called legitimate if it contains no consecutive zeros, e.g., 0101110 is legitimate, whereas 10100111 is not. Let an denote
the number of legitimate bit strings of length n. Dene a0 = 1. Derive a recurrence relation for an (i.e., express an in terms of the preceding ai's).

retagged by

2 Answers

Best answer
1 votes
1 votes

  1. $n$ length bit strings can end with $0$ or $1$
  2. We can always patch one $1$ to the end of all $n-1$ length strings of the required type.
  3. Therefore no. of $n$ length bit strings that do not contain consecutive zeros and which ends with $1$ is equal to $a_{n-1}$ where $a_{n-1}$ = $n-1$ length bit strings that do not contain consecutive zeros.
  4. We can also patch one $0$ at the end of all such $n-1$ length strings which do not contain consecutive zeros and that ends with $1$.
  5. In point $3$ we have just derived that, $a_{n-1}$ = $n$ length strings that do not contain consecutive zeros and ends with $1$. So, therefore, To satisfy point $4$, we have, no of $n$ length bit strings that do not contain consecutive zeros and that ends wth $0$ = no of $n-1$ length bit strings that do not contain consecutive zeros and that ends wth $1$ = $a_{n-2}$  
  6. There is no other possibility of ending a string other than with $0/1$ and there are no overlapping cases.
  7. Therefore final recurrence relation : $a_n = a_{n-1} + a_{n-2}$
selected by
0 votes
0 votes

It is simply fibonacci series, with basis

a0=1 & a1=2

Then an=an-1+an-2

a1=2 can be derived by enumeration only 2 single length binary string can be form and because its length is 1 so no consecutive 0's

Related questions

0 votes
0 votes
1 answer
1
AKS1236 asked May 18, 2022
780 views
I solved the question using the logic first select two questions from each sections. ($\binom{5}{2} * \binom{5}{2}$). Then from remaining 6 questions choose any 2. theref...
3 votes
3 votes
2 answers
2
Akriti sood asked Nov 7, 2016
6,670 views
A palindrome is a string whose reversal is identical to the string. How many bit strings of length n are palindromes? 2⌈n⁄2⌉ 2(⌊ n/2⌋ ) 2⌈n⁄2⌉ -1 2(�...
7 votes
7 votes
2 answers
3