Write a regular expression that defines the language over ab

Write a regular expression that defines the language over {a,b,c}, consisting of all words in which c\'s can only occur when an odd number of a\'s have been seen up to that point. So c\'s can occur between the 1st and 2nd a\'s, and between the 3rd and 4th a\'s, but not between the 2nd and 3rd a\'s (and so on).

Solution

Rregular expression S that defines the language over {a,b,c}, consisting of all words

Here c\'s can only occur when an odd number of a\'s have been seen up to that point.

example:- {aca, acaaca, acaacaaca}

so S= b*(ac+b*ab*)*

a*={null, a, aa, aaa, aaaa, aaaaa, .....}

a+ ={a, aa, aaa, aaaa,....}

So here Regular Expression S =b*(ac+b*ab*)* will follow above condition

---------------------------------------------------------------------------------------------

If you have any query, please feel free to ask.

Thanks a lot.

Write a regular expression that defines the language over {a,b,c}, consisting of all words in which c\'s can only occur when an odd number of a\'s have been see

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site