GATE Computer ScienceVery hardGATE CSE
How many binary strings of length 12 do not contain three consecutive 1s as a substring?
- A. 1705
- B. 377
- C. 1817
- D. 2391
Correct answer: A. 1705
Let a(n) = a(n−1)+a(n−2)+a(n−3) with a(0..2) = 1, 2, 4; a(12) = 1705 (confirmed by enumeration).
More Algorithms questions
- Five keys k1<k2<k3<k4<k5 are searched with access frequencies 4, 2, 6, 3, 9. For a binary search tree over these keys, with the root at…
- What is the minimum number of comparisons needed in the worst case to find the SECOND smallest of 100 distinct elements?
- Consider T(n) = 2T(n/2) + n/log₂n for n ≥ 2 (n a power of 2, T(1) = 1). Which is the tightest bound? (The Master theorem in its basic form…
- Let T(n) = 2T(√n) + log₂ n for n > 2, with T(2) = 1, where n is always of the form 2^(2^k). What is the exact value of T(2^16)?
- Consider T(n) = 2T(n/2) + 8T(n/4) + n² with T(1) = 1 (the subproblem sizes add up to 3n, not n). Which is the tight bound?
- Let T(n) = 2T(n/2) + n·log₂ n for n ≥ 2, T(1) = 1, with n = 2^k. Which is the exact closed form of T(n)?