GATE Computer ScienceVery hardGATE CS
How many strings of length 12 over {a, b} contain exactly three occurrences of aa as a substring (overlapping occurrences counted separately, so aaa has two)?
- A. 806
- B. 792
- C. 825
- D. 840
Correct answer: A. 806
The number of aa occurrences equals the sum over maximal runs of a of (run length − 1). Enumerating all 4096 strings (or a transfer-matrix count over last symbol and occurrence number) gives 806.
More Theory of Computation questions
- L₁ is accepted by a minimal complete DFA with 4 states and L₂ by a minimal complete DFA with 3 states. What is the largest number of…
- The minimal complete DFA of a language L has 5 states. What is the largest number of states that the minimal complete DFA of the Kleene…
- Let L = { w ∈ {a, b} : every prefix u of w satisfies |na(u) − nb(u)| ≤ 2 }. How many states does the minimal complete DFA for L have?
- Let r = (aab + ab + b)(ba + a). The number of strings of length 7 over {a, b} that are NOT in L(r) is
- Consider the languages: I. HALT = { ⟨M, w⟩ : M halts on w }; II. EQTM = { ⟨M₁, M₂⟩ : L(M₁) = L(M₂) }; III. TOTAL = { ⟨M⟩ : M halts on…
- Which of the following languages can be accepted by a deterministic pushdown automaton by EMPTY STACK (the stack is empty at the end of…