Transformation from DFA to regular expression

35 Views Asked by At

dfa

What is the correct regular expression for this DFA?

I came up with the solution

0|1(0(0|1))*1*

The problem with my solution is, that it's not possible to use the q2->q2 and then loop through q1 and q2.

The correct answer according to the paper is

(0|1)(1|0(0|1))∗

This one looks false too, because it looks like its not possible to go q1->q2->q2.

So my question is, what is the correct regular expression and why. And why is my solution may wrong (maybe more errors than I already exposed to you)?

1

There are 1 best solutions below

1
On BEST ANSWER

So the solution is fairly easy. I didn't read the answer from the paper correctly.

So (1|0(0|1))

is read 1 OR 0(0|1)