CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

For a string w, we define wR to be the reverse of w. For example,if w=01101 then wR=10110. Which of the following languages is/are context-free?

Open in App
Solution

Option (a) : {wxwRxR | w,x ϵ{0,1}}
By putting w as "ϵ" we will get {xxR|xϵ{0,1}} which still has string matching. So,this will not be regular. Similary,by putting x as ϵ it will be {wwRϵ {0,1}} which still has string matching and will not become regular.
So,we need to do string matching but alternate order string matching is not possible in PDA. So,it is a CSL.Option (a) is a CSL but not CFL.
Option (b) L: {wxwR | w,x ϵ{0,1}}
By putting w as "ϵ" we get x|xϵ {0,1}}=(0+1)
Since a subset of L is (0,1). L itself must be (0,1) which is regular and hence CFL.
Option (b) is a CFL.
Option (c) : {wwRxxR | w,x ϵ{0,1}}
Here by putting x or w as ϵ,we cannot remove string matching, So,it is not regular. But it is CFL since in a NPDA we can push w, pop for wR match it and then push x and pop for xR and match it again and so this language is a CFL.
option (d) : {wxxwRwR | w,x ϵ{0,1}}
Here,also by putting w or x as ϵ,we cannot make it regular. NPDA can do this,push both w and x and then xR pop and wR pop and match. By push, push, pop, pop this can be accepted by NPDA. So,option (d) is CFL.



flag
Suggest Corrections
thumbs-up
1
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Introduction to CFL
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon