All mock tests are FREE till 31 December — register to save your progress
Unit 8 · Theory of Computation and Compilers Paper 2 CS · December 2018

Consider L₁ = {a^(n+m) bⁿ aᵐ | n, m ≥ 0} and L₂ = {a^(n+m) b^(n+m) a^(n+m) | n, m ≥ 0}. Which one is correct?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: A. Only L₁ is context free

Explanation

L₁ = aᵐ aⁿ bⁿ aᵐ has nested matching, so it is context free. L₂ = aᵏ bᵏ aᵏ needs three equal counts, which no PDA can check.

More Theory of Computation and Compilers questions