Question
The minimum possible number of states of a deterministic finite automaton that accepts the regular language is
Official answer and solution
- Official answer
- 8
- From
- Official GATE 2017 answer key
Solution
Construct the minimal deterministic finite automaton (DFA) recognizing the length-constrained language .
The language is .
This requires:
- Exactly 2 arbitrary characters of (positions 1 and 2).
- The 3rd character must be ''.
- Followed by at least 3 arbitrary characters of (positions 4, 5, 6 and beyond).
Construct the DFA states based on progress through the required string structure:
- State : Start state (0 symbols read).
- State : 1st symbol read from .
- State : 2nd symbol read from .
- From :
- On '': Successfully reads the mandatory '' at position 3; transitions to .
- On '': The 3rd symbol is '', which violates the definition since must be exactly 2; transitions to dead/trap state .
- State : 3 symbols read (including '' at position 3). Needs at least 3 symbols to accept.
- State : 4 symbols read (1 symbol of ).
- State : 5 symbols read (2 symbols of ).
- State : 6 or more symbols read (at least 3 symbols of ). This is the accepting state; self-loops on .
- State : Dead state; self-loops on .
Total number of states in this minimal DFA is:
8
Forgetting the dead/trap state for inputs whose 3rd symbol is ''.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 2
- Question
- 25 of 65, printed as CS Q.25
- 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.