GATE / CS ARCHIVE

GATE CSE 2016 SET 1 / QUESTION 2

GATE CSE 2016 Set 1 Q2

Discrete Mathematics · Recurrences & Generating Functions · Full GATE CSE 2016 Set 1 paper

GATE 2016 Set 1, Q2 1 mark · MCQ
Report issue

Recurrences & Generating Functions

Question 2, GATE 2016: Let a_n count length-n binary strings with no consecutive 1s. Which recurrence holds? A: a_n=a_(n−1)+2a_(n−2). B: a_n=a_(n−1)+a_(n−2). C: a_n=2a_(n−1)+a_(n−2). D: a_n=2a_(n−1)+2a_(n−2).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Partition valid n-bit strings by their last symbol. Those ending 0 append 0 to any valid (n−1)-bit string. Those ending 1 must end 01 and append 01 to a valid (n−2)-bit string. Hence an=an−1+an−2, B, with a0=1, a1=2.

The two cases must be disjoint and exhaustive. For n≥2, a valid string ends either in 0, or in 01; the latter is forced because a final 1 cannot follow another 1. Removing those suffixes gives arbitrary valid shorter strings and is reversible, so there is neither overcounting nor omission. For example a2=3 corresponds to 00,01,10, matching a1+a0=2+1. Initial values accompany the recurrence even though only the recurrence is requested.

Original paper, page 4 · Answer key