DFA Implementation C Program
✅ Language accepted: Strings ending with 01
Examples of accepted strings: 01
, 101
, 1101
, 00001
Examples of rejected strings: 0
, 1
, 10
, 111
, 00
🔤 DFA States:
-
q0
: Start state -
q1
: Saw0
-
q2
: Saw01
(Accepting state)
✅ C Code:
🧠 Explanation:
-
The DFA moves between states based on the current character.
-
Only strings that end in the pattern
01
will leave the DFA in stateq2
. -
state == 2
is the accepting condition.
Comments
Post a Comment