Computer Science EngineeringVery hard

The language {a^n b^m | n != m} is

  1. A. regular
  2. B. context-free but not regular
  3. C. context-sensitive but not context-free
  4. D. not recursive

Correct answer: B. context-free but not regular

A nondeterministic PDA can guess whether a's or b's are in excess, but no finite automaton can compare the counts.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic