Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top