GATE / CS ARCHIVE

GATE CSE 2007 / QUESTION 31

Regular language among palindrome-based forms

Theory of Computation · Regular Expressions & Languages · Full GATE CSE 2007 paper

GATE 2007, Q31 2 marks · MCQ
Report issue

Regular Expressions & Languages

Question 31, GATE 2007: Which language is regular? In all options w and x are nonempty binary strings, w^R is the reversal of w, and Σ={0,1}.
Options:
(A) {ww^R:w∈Σ+}
(B) {ww^R x:w,x∈Σ+}
(C) {wxw^R:w,x∈Σ+}
(D) {xww^R:w,x∈Σ+}
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Approach. The existential decomposition matters: for option C, w can always be chosen to have length one. This removes the apparent need to remember an arbitrarily long prefix. A direct regular expression is 0(0|1)+0 | 1(0|1)+1.

2. Derivation and interpretation. In C, every string wxwR has the same first and last symbol and length at least 3. Conversely any binary string of length≥3 with equal endpoints has such a representation by choosing w to be its first single symbol and x its nonempty middle. Thus C equals 0(0+1)+0 ∪1(0+1)+1 and is regular. A is the nonempty even-palindrome language and nonregular. For B, intersect with the regular language 0(11)*1 00 (11)*1 01. The result is{0 1k 00 1k 01:k positive odd}: the only possible even-palindrome prefix must match the two odd-length 1 blocks. This equality language is nonregular by pumping the first block. Hence B is nonregular. D is the reversal of B and is likewise nonregular.

Original paper, page 7