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?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2016 Set 1 · Q2
Time
Select one answerSingle correct
Solution
Official answer: B) an = an-1 + an-2
Recurrence RelationsLet denote the number of valid -bit binary strings without consecutive s.
Any valid -bit binary string can either:
End in : The first bits can be any valid -bit string without consecutive s. There are such strings.
End in : The bit immediately preceding it must be (so it ends in ) to prevent consecutive s. The remaining first bits can be any valid -bit string. There are such strings.
Summing these two mutually exclusive cases gives:
Hence, option (B) is the correct recurrence relation.
Try the question first, then check your work.
Examiner trap
Condition on the last bit of the binary string: if it ends in 0, the remaining prefix has length ; if it ends in 1, the preceding bit must be 0.
This Recurrence Relations previous year question is Q2 of the GATE CSE 2016 Set 1 paper. Find more GATE CSE PYQs on Recurrence Relations in Engineering Mathematics, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 4 related Recurrence Relations PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Recurrence Relations has 4 GATE CSE PYQs across 4 papers from 2016 to 2024. 3 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2016 Set 1.
How GATE tests Recurrence RelationsIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.