No you are not correct :(
you not need to create start state. the first state with -
sign is the start state. Also a,b
label means a
or b
but not ab
there is a theorem called Arden's theoram, will be quit helpful to convert NFA into RE
What is Regular Expression for this NFA?
In you NFA
the intial part of DFA:
step-1:
(-) --a,b-->(1)
means (a+b)
step-2: next from stat 1 to 2, note state 2 is accepting state final (having +
sign).
(1) --b--->(2+)
So you need (a+b)b
to reach to final state.
step-3: One you are at final state 2
, any number of b
are accepted (any number means one or more). This is because of self loop on state 2
with label b
.
So, b*
accepted on state-2.
step-4:
Actually there is two loops on state-2
.
So, In step-3 and step-4 because of loop on state-2 run can be looped back via b
labeled or via aa*b
===> (b + aa*b)*
So regular expression for your NFA is:
(a+b)
b
(b + aa*b)*