Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

only have to do b and c Give regular expressions for each of the following subse

ID: 3552900 • Letter: O

Question

only have to do b and c


Give regular expressions for each of the following subsets of {a, b}*. {x | x contains an even number of a's} {x | x contains an odd number of b's} {x | x contains an even number of a's or an odd number of b's} {x | x contains an even number of a's and an odd number of b's} Try to simplify the expressions as much as possible using the algebraic laws of Lecture 9. Recall that regular expressions over {a, b} may use epsilon, phi, a, b, and operators +, *, and only; the other pattern operators are not allowed.

Explanation / Answer

b.x contains odd nunmber of b's


(a*ba*b)*a*ba*


from this we can get all strings with only one b, 3 b's ,5 b's .......



c.

for even number of a's..(b+ab*a)*


for odd number of b's ..(a*ba*b)*a*ba*


as its given 'OR' we can add them both so we get..


(b+ab*a)*+(a*ba*b)*a*ba*