Regular Expressions & Translation of Regex to NFA
- Give regular expressions for the following:
-
The set of strings over alphabet $A=\{0,1\}$ that contains no two adjacent 1s:
\[(1+\epsilon)(0^*01)^*0^*\] -
For the following state diagram:
\[(a+b)^*b(a+b)(\epsilon +a+b)\]stateDiagram-v2 direction LR [*] --> 1 1 --> 1:a,b 1 --> 2:b 2 --> 3:a,b 3 --> 4:a,b 3 --> [*] 4 --> [*]
-
- Consider the following regular expressions which are given along with three words - for each word say whether it belongs to the language of the regular expression:
- $a^*b^*c^*d^*$
- $abcd$ - Yes
- $abbc$ - Yes
- $aba$ - No
- $(ab)^*(abb)^*$
- $ababab$ - Yes
- $ababba$ - No
- $ababbab$ - No
For each pair of regular expressions below, say whether they represent the same language. If they correspond to different languages, give an example of a word that belongs to one language but not the other.
- $(a^*)\cup(b^*)$ and $\{a,b\}^*$ - No ($ab$)
- $\{a,ab,abc\}{d,cd}$ and $\{a,ab\}\{c,cd,d\}$ - No ($ac$)
- $(ab)^*\cup(aba)^*a$ and $a((ba)^*\cup(baa)^*)$ - No ($ab$)
- $a^*b^*c^*d^*$