TOC Unit2
TOC Unit2
Solution:
All combinations of a's means a may be zero, single, double and so on. If
a is appearing zero times, that means a null string.
That is we expect the set of {ε, a, aa, aaa, ....}. So we give a regular
expression for this as:
R = a*
That is Kleen closure of a.
Example 2:
Write the regular expression for the language accepting all combinations
of a's except the null string, over the set ∑ = {a}
Solution:
The regular expression has to be built for the language
L = {a, aa, aaa, ....}
The (a + b)* shows any combination with a and b even a null string.
Example 4:
Write the regular expression for the language accepting all the string
which are starting with 1 and ending with 0, over ∑ = {0, 1}.
Solution:
In a regular expression, the first symbol should be 1, and the last
symbol should be 0. The r.e. is as follows:
R = 1 (0+1)* 0
Example 5:
Write the regular expression for the language starting and ending with a
and having any having any combination of b's in between.
Solution:
The regular expression will be:
R = a b* a
Example 6:
Write the regular expression for the language starting with a but not
having consecutive b's.
Solution:
Example 8:
Write the regular expression for the language over ∑ = {0} having
even length of the string.
Solution:
The regular expression has to be built for the language:
R = (00)*
Example 9:
Write the regular expression for the language having a string which
should have atleast one 0 and alteast one 1.
Solution:
Example 10:
Describe the language denoted by following regular expression
r.e. = (b* (aaa)* b*)*
Solution:
The language can be predicted from the regular expression by
finding the meaning of it. We will first split the regular expression
as:
Concatenation case
ab
Closure case
a*
REGULAR EXPRESSION TO
NFA
Example - 5
Example - 6
IDENTITY RULES
Solution: