DFA Construction with three strings in language

116 Views Asked by At

Draw DFA that recognizes the following language, with the alphabet {0, 1}

{0011, 11, 0101}

I'm having a lot of trouble with this, because I know DFA have to have a determined path from each state for both 0 and 1. I don't know how to make one that accepts all three and only those three.

Edit: What about a language such as {0011, 00, 0101}?

2

There are 2 best solutions below

0
On BEST ANSWER

Sorry, I'm no good at drawing diagrams so you will have to draw one yourself. State $q_0$ is the initial state and $q_4,q_7,q_9$ are accepting states. $$\matrix{\hbox{state}&0&1\cr q_0&q_1&q_8\cr q_1&q_2&q_5\cr q_2&q_{10}&q_3\cr q_3&q_{10}&q_4\cr q_4&q_{10}&q_{10}\cr q_5&q_6&q_{10}\cr q_6&q_{10}&q_7\cr q_7&q_{10}&q_{10}\cr q_8&q_{10}&q_9\cr q_9&q_{10}&q_{10}\cr q_{10}&q_{10}&q_{10}\cr}$$ If you look at your diagram I think you will see how you can quite easily draw a DFA for any finite language.

0
On

You just need 6 states: initial state 1, final state 6.

$1 \xrightarrow{0} 2 \xrightarrow{0} 4 \xrightarrow{1} 5 \xrightarrow{1} 6 \qquad 1 \xrightarrow{1} 5 \qquad 2 \xrightarrow{1} 3 \xrightarrow{0} 5$