similar problem from Rosen

The Gateway to Computer Science Excellence

+1 vote

Let $A(n)$ denotes the number of $n$ bit binary strings which have no pair of consecutive $1’s.$ what will be recurrence relation for it and what will be it’s Time Complexity??

0

You can use dynamic programming to get the answer in $O(n)$ , since the recurrence is same as that of the Fibonacci one.

+1

@srestha mam, $a_1=2$ because 0 and 1 are possible strings of size 1 where no consecutive 1 occurs

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.5k
- Others 1.5k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,647 questions

56,461 answers

195,358 comments

100,241 users