What is the regular expression for the language L={w| w starts with 1 and has odd length}? The alphabet of the language is {0, 1};
Solution:
Given,
=>Alphabet() = {0, 1}
=>Language L = {w | w starts with 1 and has odd length}
Explanation:
Finding regular expression:
=>As w has odd length so excluding "1" the length of string will be even.
=>There can be any combination of 0 and 1 after 1.
=>For even length regular expression with 0 and 1 = ((0+1)(0+1))*
=>Hence the regular expresion of w starts with 1 and has odd length = 1((0+1)(0+1))*
I have explained each and every part with the help of statements attached to the answer above.
Get Answers For Free
Most questions answered within 1 hours.