1,295 views
2 votes
2 votes
which of the following is regular grammar?

a) L1 = { XcY | X,Y belongs to (a,b)* and c is constant }.

b) L2 = { WcW^r | W belongs to (a,b)* and W^r is the reverse of W }.

 

Please answer with explanation.

1 Answer

Best answer
2 votes
2 votes

Option 1 only as L1 can be written as (a+b)*c(a+b)* // any string containing c as a sub-string.

For L1 F.A can be drawn easily therefore L1 is regular.

Lis not regular as F.A cannot compare W and Wr , It can be easily done by deterministic PDA (For occurrence of W i.e. (a+b)* in the string push into stack until first c is seen and after that match the input with top of the stack and POP if matched). Therefore L2 is DCFL.

selected by

Related questions

0 votes
0 votes
2 answers
1
programmer1218 asked Apr 11
118 views
Can anyone explain how we can write this regular language for the following diagram ?(in depth)
0 votes
0 votes
0 answers
2
Vedantthakkar asked Feb 24
161 views
Consider a regular language R and a context free language C. Let the PDA that recognizes C be called P=(QP,∑,Γ,δP,q0P,FP), and the DFA that reconginzes R be (QR...
0 votes
0 votes
1 answer
3
Deepak9000 asked Nov 27, 2023
219 views
Why is C is regular as it non regular as?Please help me with this confusion
0 votes
0 votes
1 answer
4
M_Umair_Khan42900 asked Dec 29, 2022
792 views
Show that the following pairs of regular expressions define the same language over the alphabet I = [a, b].s(a) p(pp)*( A + p)q + q and p*q(b) A +0(0+1)* + (0+1)* 00(0+1)...