Let be any string of length in . Let be the set of all substrings of . What is the minimum number of states in non-deterministic finite automation that accepts ?
View worked solution
Answer: C
To find the minimum number of states in an NFA that accepts the set of all substrings of a string of length , we can analyze both the upper bound (by construction) and the lower bound (by a worst-case example).
1. Upper Bound (Construction):
Let the string be . We can construct an NFA with states, :
- is the start state.
- All states are final (accepting) states.
- For each , there is a transition .
- To allow starting at any position in the string, we add -transitions from the start state to every other state (for ).
2. Lower Bound (Necessity):
Consider the string . The set of all substrings is .
Any NFA accepting must accept but reject . To distinguish between and , the automaton must have at least states to track the length of the string of s.
Thus, the minimum number of states in the NFA is .
Free practice · Your answers on this page are not saved.
