GATE Computer ScienceModerateGATE CS (PYQ pattern)
Over the alphabet {a, b, c}, what is the status of the complement of { aⁿbⁿcⁿ : n ≥ 0 }?
- A. Not context-free (context-sensitive only)
- B. Context-free but not deterministic context-free
- C. Deterministic context-free (accepted by a DPDA)
- D. Regular (accepted by a finite automaton)
Correct answer: B. Context-free but not deterministic context-free
The complement is the union of strings not of the form a*b*c* (regular) and a^i b^j c^k with i ≠ j or j ≠ k (CFL), so it is context-free. If it were a DCFL, its complement aⁿbⁿcⁿ would be a DCFL (DCFLs are closed under complement), but aⁿbⁿcⁿ is not even context-free.
More Theory of Computation questions
- Consider the language L of strings over {a, b} that contain both abab and bb as substrings, have na ≡ 1 (mod 3) and have an even number of…
- What is the length of the shortest string over {a, b} that has length divisible by 4, contains both aab and bba, has an odd number of b's…
- L₁ is the set of strings over {a, b} containing aa and L₂ the set containing bb. How many strings of length at most 6 lie in the symmetric…
- Let h be the homomorphism h(a) = 0, h(b) = 01. How many distinct strings of length exactly 10 are in the image h({a, b})?
- Which of the following decision problems can be solved by an algorithm that always halts?
- How many strings of length 10 over {a, b} contain aa as a substring but do not contain bb?