The definition of a language L with alphabet {a} is given as following. L = { ank | k > 0, and n is a positive integer constant} What is the minimum number of states needed in a DFA to recognize L?
A. k+1
B. n+1
C. 2n+1
D. 2k+1
I have been asked this question during an interview for a job.
This intriguing question comes from Transformation from NFA to DFA topic in division Finite Automata and Regular Expression of Compiler
Correct choice is B. n+1
To explain I would say: Note that n is a constant and k is any positive integer. For example, let n=3, then the DFA must be able to accept aaa, aaaaaa, aaaaaaaaa, , .. build such a DFA, 4 states are required.