GATE Computer ScienceVery hardGATE CS (PYQ pattern)
How many strings of length 8 over {a, b, c} have no two adjacent equal symbols and also have first symbol ≠ last symbol?
- A. 384
- B. 320
- C. 264
- D. 258
Correct answer: D. 258
These are proper 3-colourings of the cycle C₈: (k−1)ⁿ + (−1)ⁿ(k−1) = 2⁸ + 2 = 258. Ignoring the wrap-around condition gives 3·2⁷ = 384.
More Theory of Computation questions
- How many binary strings of length 10 contain no two consecutive 1s and also do not have 1 at both the first and the last position?
- How many strings of length 9 over {a, b} satisfy (na − nb) ≡ 0 (mod 3) AND contain no bb as a substring?
- How many binary strings of length 10 contain 0110 as a substring?
- How many strings of length 7 over {a, b} belong to the language of the regular expression (a + ab + ba)?
- How many strings of length 10 over {a, b} lie in the language of the regular expression abab?
- The regular expression ((aa + bb)(ab + ba)) is over Σ = {a, b}. How many states does the minimal complete DFA for its language have?