Let the alphabet Sigma = {0, 1}. Write a regular expression for each of the foll
ID: 3811954 • Letter: L
Question
Let the alphabet Sigma = {0, 1}. Write a regular expression for each of the following. In this question, you may not use the extended notation (only union, concatenation, and Kleene star). i. Bit strings that have an even number of 0's. ii. All words in which '1' appears tripled (and only tripled, meaning all 1's must appear in groups of three). The empty string is also accepted. iii. All bit strings that do not have substring '01'. iv. All bit strings that contain exactly two 0's or exactly three 0's.Explanation / Answer
i.The set of strings with even no of 0s include 00, 001, 0011, 1001, 1010, …. The regular expression can be written as
1*(01*01*)*
ii.triple 1 only so strings will be 0111,1110,00111,11100,01110, that means any number of 0s but (111) together,the regular expression can be 0*((111)*0*)*
iii. string with no 01 combination so it should in pattern 1followed by 0.so Regular expression can be 1*0*.
iv.exactly 2 zeros or 3 zeros means (00) or (000) only should be there and any no of 1's.so regular expression can be (1*(00)1*+1*(000)1*)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.