GATE | GATE CS 2011 | Question 42
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 DFA to recognize L?
(A)
k+1
(B)
n+1
(C)
2(n+1)
(D)
2
Answer: (B) Explanation:
In the language L = {|an| k > 0, and n is a positive integer constant}, the DFA needs to keep track of two things: the presence of at least one ‘a’ at the beginning and the count of subsequent ‘a’s.
To represent the count of subsequent ‘a’s, we can use a state for each possible value of n. Since n is a positive integer constant, we can have n possible values for subsequent ‘a’s.
Additionally, we need an initial state to represent the start of the string. This initial state transitions to the state representing the count of subsequent ‘a’s upon reading ‘a’.
Therefore, the total number of states required in the DFA is n+1, where n is the positive integer constant in the language definition.
Quiz of this Question Please comment below if you find anything wrong in the above post
Last Updated :
28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...