Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

GATE | GATE-CS-2016 (Set 1) | Question 12

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Let an be the number of n-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for an

gatecs20163
(A) A
(B) B
(C) C
(D) D


Answer: (B)

Explanation: The least value of ‘n’ for the recursion would be 3.
For n = 1, number of strings = 2 (0, 1)
For n = 2, number of strings = 3 (00, 01, 10)
For n = 3, number of strings = 5 (000, 001, 010, 100, 101)
For n = 4, number of strings = 8 (0000, 0001, 0010, 0100, 1000, 0101, 1010, 1001)

 
This seems to follow Fibonacci series and the recurrence relation for it is an = an−1 + an−2.
Thus, B is the correct choice.

 
https://www.geeksforgeeks.org/count-number-binary-strings-without-consecutive-1s/

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads