The minimum number of states in a Deterministic Finite-State Automaton for is ____________.
View worked solution
Answer: 4
The language consists of all strings over that do not contain the substring . We can construct the minimal DFA by tracking the number of consecutive s seen at the end of the input string.
Let the states represent the following tracking information:
- (Start, Accepting): No consecutive s at the end (the last character read was , or the string is empty).
- (Accepting): Exactly one consecutive at the end.
- (Accepting): Exactly two consecutive s at the end.
- (Non-accepting, Trap): Three or more consecutive s have been seen (the substring has occurred).
The transitions are defined as follows:
- From : on , on
- From : on , on
- From : on , on
- From : on
To verify minimality, we check if any states can be merged:
- is non-accepting, while are accepting, so cannot be merged with any other state.
- From , input leads to (non-accepting), whereas from and , input leads to accepting states. Thus, is distinguishable.
- From , input leads to (non-accepting), whereas from , input leads to (accepting). Thus, and are distinguishable.
Since all 4 states are pairwise distinguishable, the minimum number of states in the DFA is 4.
Free practice · Your answers on this page are not saved.
