Question
The number of states in the minimum sized DFA that accepts the language defined by the regular expression
is ________.
Official answer and solution
- Official answer
- 2
- From
- Official GATE 2016 answer key
Solution
Identify the language denoted by the regular expression and construct the minimal state DFA.
The given regular expression is:
Here, generates any binary string of length . The middle term requires at least one symbol (0 or 1) to be present.
Therefore, generates the language of all binary strings of length at least 1:
Construct the minimal DFA for over :
- Start state (non-accepting): represents the empty string . On reading 0 or 1, it transitions to .
- State (accepting): represents any string of length . On reading 0 or 1, it stays in (self-loop).
Both states are reachable and non-equivalent ( is non-accepting and is accepting). Hence, the minimum sized DFA has exactly 2 states.
2
Constructing an NFA with 3 states and not minimizing the resulting DFA.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2016 Computer Science and Information Technology (CS) Session 2
- Question
- 26 of 65, printed as CS Q.16
- 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.