Machine-translated by Google. Questions are authored in English.
Top

Discussion

Let \(M\) be the 5-state NFA with \(\epsilon\)-transitions shown in the diagram below.

NFA with states 1 to 5, start state 1, accepting states 2 and 5: 1 to 2 and 1 to 4 on epsilon; 2 to 3 on 0 and 3 to 2 on 0; 3 to 5 on epsilon; 4 to 5 on 1 and 5 to 4 on 1

Which one of the following regular expressions represents the language accepted by \(M\) ?

  • A.\((00)^{*} + 1(11)^{*}\)
  • B.\(0^{*} + (1 + 0(00)^{*})(11)^{*}\)
  • C.\((00)^{*} + (1 + (00)^{*})(11)^{*}\)
  • D.\(0^{+} + 1(11)^{*} + 0(11)^{*}\)

Answer: B

The language is \(0^{*} + (1 + 0(00)^{*})(11)^{*}\).

From the start, an \(\epsilon\)-move reaches either state 2 or state 4. Through state 2, pairs of 0s loop 2 to 3 to 2, so \((00)^{*}\) is accepted at 2; after an odd number of 0s, \(0(00)^{*}\), the machine is at 3 and can take the \(\epsilon\)-move to the accepting state 5, then read \((11)^{*}\) looping 5 to 4 to 5. Through state 4, one 1 reaches 5, then \((11)^{*}\). So

\[ L = (00)^{*} + 0(00)^{*}(11)^{*} + 1(11)^{*} \]

Since \((00)^{*} + 0(00)^{*} = 0^{*}\), this is exactly \(0^{*} + (1 + 0(00)^{*})(11)^{*}\).

\((00)^{*} + 1(11)^{*}\) misses strings such as 0 and 011. The third option includes 11, which M rejects. The last omits the empty string, which M accepts at state 2, and strings such as 00011.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.