For each of the following languages, write a regular expression that describes the language.
Using textbook RegEx notation (character, ε for empty string, space for concat, | for or, * for zero or more concats)
(a) (7 pts) The set of strings of length three or more, over alphabet {a, b}.
(b) (7 pts) The set of natural numbers divisible by 25.
(c) (7 pts) The set of strings that consist of an odd number of a’s, over alphabet {a}.
(d) (7 pts) The set of strings over alphabet {a, b} that begin with at least two a’s, and end with at least two b’s.
Expert Answer
Ans(a):
(a|b)(a|b)*(a|b)(a|b)*(a|b)(a|b)*
Ans(b):
Let E = 0|1|2|3|4|5|6|7|8|9
((E)*00)|((E)*(2|7)5)|((E)*50)
Ans(c):
a(aa)*
Ans(d):
aa(a|b)*bb.