Question
Let be the language represented by the regular expression where . What is the minimum number of states in a DFA that recognizes (complement of )?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2015 answer key
Solution
Construct the minimal DFA for L and invert accepting states to obtain the minimal DFA for the complement language.
The language contains all binary strings that contain 0011 as a substring.
A minimal DFA recognizing requires 5 states tracking prefixes of 0011:
- State : (no progress towards
0011) - State : matched
0 - State : matched
00 - State : matched
001 - State : matched
0011(accepting dead state / trap state for substring presence)
To recognize the complement language (all strings not containing 0011 as a substring), we convert the minimal DFA of by swapping accepting and non-accepting states (making accepting and non-accepting).
Because complementation on a minimal complete DFA preserves state distinguishability, the resulting DFA for remains minimal with exactly 5 states.
B
Forgetting that inverting final and non-final states of a complete minimal DFA yields a minimal DFA for the complement without adding any extra states.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2015 Computer Science and Information Technology (CS) Session 3
- Question
- 28 of 65, printed as CS Q.18
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.