Let w be any string of length n in{0,1}∗. Let L be the set of all substrings of w. What is the minimum number of states in a non-deterministic finite automaton that accepts L?
A
2n+1
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
n + 1
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
n
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
n - 1
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution
The correct option is B n + 1 Let w = "0110". To design a minimal NFA to accept all the substrings of this string, first accept the string itself as follows.
Now, to accept all the other substrings of "0110" make every state as starting state by using null moves and also make every state as final state.
The final NFA is shown below.
Since a string of length 4 requires 5 states, a string of length n will require n + 1 states.