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.8k
- Engineering Mathematics 7.4k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.4k
- Others 1.7k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,666 questions

56,157 answers

193,767 comments

93,740 users