GATE / CS ARCHIVE

GATE CSE 2008 / QUESTION 78

Counting strings with no consecutive zeros

Discrete Mathematics · Recurrences & Generating Functions · Full GATE CSE 2008 paper

GATE 2008, Q78 2 marks · MCQ
Report issue

Recurrences & Generating Functions

Question 78, GATE 2008: Let xₙ count binary strings of length n containing no consecutive zeros. Which recurrence does it satisfy?

(A) xₙ=2xₙ₋₁
(B) xₙ=x⌊ₙ/₂⌋+1
(C) xₙ=x⌊ₙ/₂⌋+n
(D) xₙ=xₙ₋₁+xₙ₋₂
Question 78, GATE 2008: Let xₙ count binary strings of length n containing no consecutive zeros. Which recurrence does it satisfy?

(A) xₙ=2xₙ₋₁
(B) xₙ=x⌊ₙ/₂⌋+1
(C) xₙ=x⌊ₙ/₂⌋+n
(D) xₙ=xₙ₋₁+xₙ₋₂
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Divide valid strings of length n≥2 by their first bit. A leading 1 can be followed by any valid length-(n−1) string.
2. A leading 0 must be followed by 1, leaving any valid length-(n−2) suffix. These two groups cannot overlap and cover every valid string.
3. Add their counts: xₙ=xₙ₋₁+xₙ₋₂, D. Initial values are x₀=1 and x₁=2, which are essential for numerical evaluation.

Original paper, page 17