Construct regular expressions for the below ‘English’ statements. If you cannot construct one, explain why that may be the case. 1. Given an alphabet Σ = {a, b}, construct a regular expression for strings that have even length (e.g., aa, abab, babaab, etc.). 2. Given an alphabet Σ = {a, b, c}, construct a regular expression for strings that have an even length and start with a (e.g., ac, aabc, acca, abcabc, etc.). 3. Given an alphabet Σ = {0, 1, 2}, construct a regular expression for string with length 3 and the middle symbol is not 2 ( e.g., 000, 111, 012, 201, etc.). 4. Given an alphabet Σ = {0, 1, 2}, construct a regular expression that matches strings where the count of 1’s is precisely twice the count of 0’s and where the count of 2’s is the same as the count of 0’s (e.g., 1012, 2011, 20211011, etc.). 5. Given an alphabet Σ = {0, 1}, construct a regular expression for strings with at most three 1’s (e.g., 0, 01, 1001, 11001, etc.).
Construct regular expressions for the below ‘English’ statements. If you cannot construct one, explain why
that may be the case.
1. Given an alphabet Σ = {a, b}, construct a regular expression for strings that have even length (e.g.,
aa, abab, babaab, etc.).
2. Given an alphabet Σ = {a, b, c}, construct a regular expression for strings that have an even length
and start with a (e.g., ac, aabc, acca, abcabc, etc.).
3. Given an alphabet Σ = {0, 1, 2}, construct a regular expression for string with length 3 and the middle
symbol is not 2 ( e.g., 000, 111, 012, 201, etc.).
4. Given an alphabet Σ = {0, 1, 2}, construct a regular expression that matches strings where the count
of 1’s is precisely twice the count of 0’s and where the count of 2’s is the same as the count of 0’s
(e.g., 1012, 2011, 20211011, etc.).
5. Given an alphabet Σ = {0, 1}, construct a regular expression for strings with at most three 1’s (e.g.,
0, 01, 1001, 11001, etc.).
Trending now
This is a popular solution!
Step by step
Solved in 3 steps