Question 1: Write regular expressions for
·
A Set of strings including { d, abd, cd, abcd}
·
A Set of Strings of x's, y's and z's
For
example {xxx, xxy, xxz……….zzz}
Ans : The regular expression
for Set of strings including {d, abd, cd, abcd}can be written in two
ways.
i)
d | abd | cd | abcd
ii)
(c | ab | abc )d | d
The
required regular expression for Set of strings of x's, y's and z's
can also be written in two ways.
iii)
[xyz][xyz][xyz] or [x-z][x-z][x-z]
iv)
(x|y|z) (x|y|z) (x|y|z)
|