Reputation: 1680
as the title suggests I want somebody to help me in coding the conversion of NFA to DFA . I need the pseudocode only . I have tried searching using Google , and I found the whole source code even , however there were little resource to help me for giving me a formal method (in written words,not via picture) for the conversion . This is a homework problem , and I have already passed the due date , so I really need some altruism here .
Thanks.
Upvotes: 3
Views: 6347
Reputation: 5744
I've written an article on this subject.
Converting a NFA to a DFA by subset construction
It includes pseudocode on how to do the transformation as well.
Basically the algorithm is, starting with the starting state of the NFA:
Perform closure on the current state set
For each input symbol do the GOTO operation on the closure set.
If the state set you get from the GOTO is not empty
Do a closure of the state set.
If it is a new set of states:
add a transition between the state sets on the input
repeat the entire operation on this new set
Else
add a transition between the state sets on the input
Do this until there are no more sets or transitions added. It's a difficult algorithm to explain, but not very hard if you have the two basic operations CLOSURE
and GOTO
done.
Upvotes: 8