Question #38197

Consider the following languages

L1 = { 0^p 1^q 0^r | p,q,r >=0 }
L2 = { 0^p 1^q 0^r | p,q,r >=0, p != r }

Determine whether they are regular or context-free.

Expert's answer

Answer on Question#38197 - Math - Other

L1={0p1q0rp,q,r0}L_{1} = \{0^{p}1^{q}0^{r}|p,q,r\geq 0\} is regular:


L2={0p1q0rp,q,r0,pr}L_{2} = \{0^{p}1^{q}0^{r}|p,q,r\geq 0,p\neq r\} is context-free language. We can accept or reject L2L_{2} with single stack, insert pp 0s0^{\prime}s into stack skip 1s1^{\prime}s . For each 0 corresponding to rr , remove 0 from stack.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS