1,113 views
2 2 votes
Which of the following is/are CFL?

1) L = { xy | |x|=|y| }

2) L = { x#y | |x|=|y| }

1 Answer

2 2 votes
Both 1 and 2 are CFL.

as both can be accepted by using push down automata.

Language 1 generates the strings of type xy ,xxyy, xxxyyy and so on which can be accepted by pushing all x into the stack and then for every y pop one x out of the stack .

Language 2 generates the strings of type x#y, xx#yy, xxx#yyy and so on which can be accepted by pushing all x into the stack after that we have to skip the # and then for every y we have to pop one x out of the stack.

In both cases the PDA accepts the string with empty stack .
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.1k
1.1k views
practicalmetal asked Mar 20, 2023
1,073 views
Is the following language CFL :{ ww | w in (a+b)* and |w| <1000 }
0 0 votes
1 answers 1 answer
986
986 views
practicalmetal asked Mar 15, 2023
986 views
Is the following language context free:The set of all strings with number of a’s equal to number of b’s and the sum of a’s and b’s to be divisible by 3.
0 0 votes
0 0 answers
397
397 views
2 2 votes
2 2 answers
733
733 views
DukeThunders asked Jun 9, 2019
733 views
Hi, I am having a doubt understanding the result of CFL – Regular:Here’s my approach:CFL – Regular = CFL INTERSECTION Regular’ = CFL INTERSECTION Regular = CFLSuppose som...