GATE Computer ScienceModerateGATE CS (PYQ pattern)

For the regular language L(r) with r = (ab + ba)*, the pumping lemma asks for a length p such that every w ∈ L with |w| ≥ p can be split w = xyz with |xy| ≤ p, |y| ≥ 1 and xyⁱz ∈ L for all i ≥ 0. What is the smallest such p?

  1. A. 2
  2. B. 4
  3. C. 5
  4. D. 3

Correct answer: A. 2

The minimal complete DFA has 4 states, so p = 4 always works, but the smallest valid p can be smaller: here a brute-force check over all strings gives 2. (A p is valid iff every sufficiently long member has a pumpable loop in its first p symbols.)

More Theory of Computation questions

Exams that ask this topic