COMPILER DESIGN

LEXICAL ANALYSIS

REGULAR EXPRESSIONS AND FINITE AUTOMATA

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The construction time for DFA from an equivalent NFA (m number of node)is:
A
O(m2)
B
O(2m)
C
O(m)
D
O(log m)
Explanation: 

Detailed explanation-1: -The construction time for a DFA from an NFA is O(2^m) where m is the number of nodes. The running time of a DFA is O(n) where n is the length of the input string. This is because there is only 1 path through the DFA for a given string.

Detailed explanation-2: -A state in a DFA will be a subset of the set of states of the equivalent NFA. So, the maximum number of states in the equivalent DFA of an NFA, will be 2n, where n is the number of states in NFA, as a set with n items has maximum 2n subsets.

Detailed explanation-3: -DFA has only one move on a given input symbol. Let, M = (Q, ∑, , q0, F) is an NFA which accepts the language L(M). There should be equivalent DFA denoted by M’ = (Q’, ∑’, q0’, ’, F’) such that L(M) = L(M’).

Detailed explanation-4: -If NFA of 6 states excluding the initial state is converted into DFA, maximum possible number of states for the DFA is ? Explanation: The maximum number of sets for DFA converted from NFA would be not greater than 2n.

There is 1 question to complete.