290 likes | 457 Views
NFA To DFA. a,b. a. 2+. -1. NFA – without . Convert the following NFA into DFA. NFA – without . We find transition table for NFA. NFA – without . Now we construct transition table for DFA T D (1,a) = T N (1,a) = {1,2} T D (1,b) = T N (1,b) = {1}
E N D
NFA To DFA Dr. Shakir Al Faraji
a,b a 2+ -1 NFA – without Convert the following NFA into DFA Dr. Shakir Al Faraji
NFA – without We find transition table for NFA Dr. Shakir Al Faraji
NFA – without Now we construct transition table for DFA TD(1,a) = TN(1,a) = {1,2} TD(1,b) = TN(1,b) = {1} TD({1,2},a) = TN(1,a) U TN(2,a) = {1,2} UØ= {1,2} TD({1,2},b)=TN(1,b)UTN(2,b)={1}UØ={1} Dr. Shakir Al Faraji
NFA – without Ttransition table for DFA Dr. Shakir Al Faraji
a b {1,2}+ {1} - b a NFA – without Dr. Shakir Al Faraji
a,b a y2+ -y1 NFA – without -another method Convert the following NFA into DFA Dr. Shakir Al Faraji
a,b a,b a a,b y3 y2+ -y1 NFA – without Convert the following NFA into DFA Dr. Shakir Al Faraji
NFA – without Dr. Shakir Al Faraji
NFA – without Dr. Shakir Al Faraji
a Z2+ b Z1- b a a b a Z3+ Z4 b NFA – without Dr. Shakir Al Faraji
a,b a a a,b + - NFA – without Example: convert the NFA into DFA Dr. Shakir Al Faraji
NFA – with - closure If s is an NFA state, then the lambda closure of s, denoted (s) , is the set of states that can be reached from s by traversing zero or more edges. We can define (s) inductively as follows forany state s in an NFA. • s (s) • if p(s) and there is a edge from p to q, then q (s). Dr. Shakir Al Faraji
a, a b 1- 2 3 4 5+ a NFA with – Examples Dr. Shakir Al Faraji
NFA with – Examples We find transition table for NFA Dr. Shakir Al Faraji
NFA with – Examples We find - closure for five states of NFA (1) = {1,2} (2) = {2} (3) = {2,3} (4) = {2,3,4,5} (5) = {5} Dr. Shakir Al Faraji
NFA with – Examples (S) = ({s1, … , sn}) = (s1) U . . . U (sn) Dr. Shakir Al Faraji
NFA with – Examples We construct transition table for DFA TDab start {1,2} {2,3,4,5} TD({1,2}, a) =(TN(1,a) U TN(2,a)) = (ØU{3,4}) = ({3,4}) = (3) U (4) ={2,3} U {2,3,4,5} ={2,3,4,5} Dr. Shakir Al Faraji
NFA with – Examples We construct transition table for DFA TDa b start {1,2} {2,3,4,5} Ø TD({1,2}, b) =(TN(1,b) U TN(2,b)) = (ØU Ø) = Ø Dr. Shakir Al Faraji
NFA with – Examples We construct transition table for DFA TDab start {1,2} {2,3,4,5} Ø TD({2,3,4,5}, a) = (TN(2,a) U TN(3,a) U TN(4,a) U TN(5,a) ) = {2,3,4,5} Dr. Shakir Al Faraji
NFA with – Examples We construct transition table for DFA TDa b start {1,2} {2,3,4,5} Ø {2,3,4,5} {2,3,4,5} {2,3,4,5} ØØØ Dr. Shakir Al Faraji
NFA with – Examples We construct transition table for DFA TDab start 1 2Ø Final 2 22 333 Dr. Shakir Al Faraji
a,b a -1 2+ b 3 a,b NFA with – Examples Dr. Shakir Al Faraji
b a a -1 4+ a 2 3 c NFA with – Examples Convert the following NFA into DFA Dr. Shakir Al Faraji
END Dr. Shakir Al Faraji