Last Updated : 13 Dec, 2018

How many states are needed to design a DFA and NFA for which accepts the strings that ends with two consecutive a\’s or two consecutive b\’s?
(A) 3 for DFA and 4 for NFA respectively.
(B) 4 for DFA and 3 for NFA respectively.
(C) 5 for DFA and 4 for NFA respectively.
(D) 4 for DFA and 3 for NFA respectively.


Answer: (C)

Explanation: DFA which accepts the strings that ends with two consecutive a\’s or two consecutive b\’s over {a,b}:
\"\"
NFA which accepts the strings that ends with two consecutive a\’s or two consecutive b\’s over {a,b}:
\"\"
So, option (C) is correct.


Quiz of this Question


Share your thoughts in the comments