Let an represent the number of bit strings of length n containing two consecutive 1s. What is the recurrence relation for an?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2015 Set 1 · Q49
Time
Select one answerSingle correct
Solution
Official answer: A) an-2 + an-1 + 2n-2
CombinatoricsTo construct a bit string of length containing two consecutive 1s, we can condition on how the string ends:
The string ends in : The remaining prefix of length must contain two consecutive 1s. The number of such strings is .
The string ends in : The remaining prefix of length must contain two consecutive 1s. The number of such strings is .
The string ends in : The condition of having two consecutive 1s is already satisfied by the suffix 11. Hence, the preceding bits can be any arbitrary bit string. The number of such strings is .
Summing these mutually exclusive and exhaustive cases, we get the recurrence relation:
Hence, option A is the correct answer.
Try the question first, then check your work.
Examiner trap
Consider three mutually exclusive cases for the ending of the bit string: ending in 0, ending in 01, and ending in 11.
This Combinatorics previous year question is Q49 of the GATE CSE 2015 Set 1 paper. Find more GATE CSE PYQs on Combinatorics 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 5 related Combinatorics 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.
Combinatorics has 19 GATE CSE PYQs across 15 papers from 2012 to 2025. 5 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2015 Set 1.
How GATE tests CombinatoricsIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.