Discussion
Let \(a_{n}\) be the number of \(n\)-bit strings that do NOT contain two consecutive 1s. Which one of the following is the recurrence relation for \(a_{n}\)?
Answer: B
The recurrence is \(a_{n} = a_{n-1} + a_{n-2}\).
Split the valid \(n\)-bit strings by their last bit. If it ends in 0, the first \(n-1\) bits can be any valid string: \(a_{n-1}\) ways. If it ends in 1, the bit before must be 0 (no two consecutive 1s), and the first \(n-2\) bits can be any valid string: \(a_{n-2}\) ways. Adding the cases gives the Fibonacci recurrence.
Check with small cases: \(a_{1} = 2\) (0, 1), \(a_{2} = 3\) (00, 01, 10), and \(a_{3} = 5\) = 3 + 2. The other recurrences overcount; for example \(a_{n-1} + 2a_{n-2}\) gives 7 for \(n = 3\).
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development