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. Siddharth Bhardawaj asked Oct 14, 2017 Siddharth Bhardawaj 1.3k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply A_i_$_h commented Oct 14, 2017 reply Follow Share option 1 only ? 1 votes 1 votes Rupendra Choudhary commented Oct 14, 2017 reply Follow Share L1 = (a+b)*c(a+b)* // Regular , easily NFA can be drawn L2 : DCFL , not regular as to match strings Stack needed ...here by the help of c , PDA will have a clear idea when to POP so it's deterministic => DCFL 2 votes 2 votes Please log in or register to add a comment.
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. L2 is 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. nikhil_cs answered Oct 17, 2017 • selected Oct 18, 2017 by sourav. nikhil_cs comment Share Follow See all 0 reply Please log in or register to add a comment.