Question

I have heard that DFA can be simulated by Loop and NFA can be simulated by recursive method. I don't understand how that works. Can anyone give me an example?

Was it helpful?

Solution

In a sense, sure. DFAs can easily be simulated by writing a do...while loop with a switch statement in it based on the current state, whereas you can think of a simulator for NFAs as doing a search on a tree (depth first search is recursive, although you could just as well imagine a breadth-first search). There's not really any formality in this, just a casual observation about how you might implement simulators.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top