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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top