The following languages over the alphabet Σ = {0, 1} are all regular:
L = { w | w is of even length and begins with 01 }
L = { w | the numbers of 1's in w is multiple of 3 }
L = { w | w does not contain the substring 10 }
I am asked to write regular expressions for these languages, but I don't know how to do so. Can anyone give me advice on how to approach these problems?
L = { w | w is of even length and begins with 01 }
Ans: 01((0 + 1)(0 + 1))*
Explanation: 01
itself of even length to, we can suffix any even length string consist of 0
s and 1
s.
L = { w | the numbers of 1's in w is multiple of 3 }
Ans: (0*10*10*10*)*
Explanation: 0
can appear any number of time anywhere in string the restriction is over 1
it should be in multiple of 3 so *
over three 1
.
L = { w | w does not contain the substring 10 }
Ans: 0*1*
Explanation: string can't contain 10
means only 1
is allow after any 1
.