GATE Computer ScienceVery hardGATE CS

Which of the following languages are deterministic context-free? I. { aⁱbʲcᵏ : i = j or j = k } II. { aⁱbʲcᵏ : i = j, k ≥ 0 } III. { w c wᴿ : w ∈ {a, b}* } IV. { w wᴿ : w ∈ {a, b}* }

  1. A. II, III and IV only
  2. B. I and III only
  3. C. II and III only
  4. D. I, II and III only

Correct answer: C. II and III only

II is checked with a single stack count and ignores c's afterwards; III has the marker c that tells a DPDA when to start popping. I needs the machine to guess whether to match a's with b's or b's with c's (non-deterministic, in fact inherently ambiguous), and IV has no centre marker, so a DPDA cannot know the midpoint.

More Theory of Computation questions

Exams that ask this topic