Reputation: 550
Question: Build an FA that accepts only those words that do not end with ba. I want to Draw DFA for this problem but I don't understand I to do it please help me to draw this
Upvotes: 3
Views: 14088
Reputation: 66
Steps:
IMAGE: DFA of strings not ending with "ba":
Upvotes: 5
Reputation: 607
RE for a language that do not end on ba
is (a+b)*(aa+bb+ab)
here language either ends on aa
or bb
or ab
to make DFA from RE you can use this hope it would proved helpful for you https://cyberzhg.github.io/toolbox/nfa2dfa
in this given DFA ..it is accepting strings with length 2 or greater than 2 but not ending on ba
Upvotes: 1
Reputation: 28302
We need to keep track of whether we have seen substrings of ba and if we see the whole thing, make sure we're not in an accepting state at the time.
----->(q0)--b-->(q1)--a-->(q2)
Here, (q0) is accepting, (q1) is accepting and (q2) is not accepting. (q0) corresponds to having seen no part of the string ba, state (q1) to having seen the first symbol, and (q2) to having seen the whole thing. The missing transitions should therefore be:
The whole DFA looks like this:
/--|--b----\
b | |
| V |
----->(q0)--b-->(q1)--a-->(q2)
| ^ |
a | |
\--|-----------------/
Upvotes: 0