GATE | GATE-CS-2015 (Set 2) | Question 61

Which of the following languages is/are regular?

L1: {wxwR ⎪ w, x ∈ {a, b}* and ⎪w⎪, ⎪x⎪ >0} wR is the reverse of string w
L2: {anbm ⎪m ≠ n and m, n≥0
L3: {apbqcr ⎪ p, q, r ≥ 0}  

(A) L1 and L3 only
(B) L2 only
(C) L2 and L3 only
(D) L3 only

Answer: (A)


L3 is simple to guess, it is regular.
Below is DFA for L1.

L1 is interesting. The important thing to note 
about L1 is length of x is greater than 0, i.e.,
|x| > 0.
So any string than starts and ends with same character
is acceptable by language and remaining string becomes w.
Below is DFA for L1.

Quiz of this Question

My Personal Notes arrow_drop_up