Question
Consider the following language.
The minimum number of states in a DFA that accepts is _______.
Official answer and solution
- Official answer
- 6
- From
- Official GATE 2020 answer key
Solution
Analyze the congruence classes of the number of a's modulo lcm(2, 3) = 6.
Let denote the number of 's in string . The acceptance condition requires:
Examine (since ):
- : , but (Fails).
- : (Fails).
- : and (Accepts).
- : (Fails).
- : and (Accepts).
- : (Fails).
DFA state requirements:
- A DFA must track the remainder , requiring 6 states .
- Transitions: on input , ; on input , self-loop .
- Accepting states: .
- Using the Myhill-Nerode theorem, any two states and () are distinguishable by appending for a suitable . None of the 6 states can be merged.
- Therefore, the minimum number of states is 6.
Final answer
6
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2020 Computer Science and Information Technology (CS)
- Question
- 61 of 65, printed as CS Q.51
- 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.