Question #170625

Write a regular expression for the following languages, over sigma=(a,b) All strings that do not end with aa.All strings that contain an even number of b’s. All strings which do not contain the substring ba.


Expert's answer

Given,

Σ=(a,b)\Sigma =(a,b)

Condition (i) It is not ending with aa:

L={L=\{ Not end with aa }\}

={=\{ ends with ab, ba, bb }\}

(a+b)∗(ab+ba+bb)+ϵ+a+b(a+b)^*(ab+ba+bb)+\epsilon +a+b


For the second condition:

L={L=\{ even no of b′sb's }\}

={a∗ba∗)∗+a∗=\{a*ba*)*+a*


For the third condition:

L={L=\{ not contained ba}\}

=a∗b∗=a*b*


LATEST TUTORIALS
APPROVED BY CLIENTS