Let an be the number of n-bit strings that do NOT contain two consecutive 1's. Which one of the following is the recurrence relation for an ?
A
an = an−1 + 2an−2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
an = an−1 + an−2
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
an = 2an−1 + an−2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
an = 2an−1 + 2an−2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution
The correct option is Ban = an−1 + an−2 Let an be the number of n-bit strings that do not contain two consecutive 1's. we wish to develop a recurrence relation for an. Consider 1 bit strings 0, 1
So, a1 = 2
Consider 2 bit strings 00, 01, 10, 11
Out of minimum only 00, 01, 10 do not contain two consecutive 1's.
So, a2 = 3
Out of minimum six strings only 000, 001, 010, 100 and 101 five strings satisfy do not contain two consercutive 1's.
So, a3 = 5. Three numbers a1, a2, a3 satisfy clearly only (b) an = an−1 + an−2 is correct