同。如何用有限的状态解决看似需要无限状态才能解决的问题(如前面的倒
过来写的字符串对应二进制数能否被 5 整除)背后一定是有规律的,需要瞪
大眼睛去发现琢磨了。
例:Give NFA, try to take advantage of nondeterministic as much as possible.
a) The set of strings over alphabet {0, 1, …, 9} such that the final digit has
appeared before.
b) The set of strings over alphabet {0, 1, …, 9} such that the final digit has
not
appeared before.
c) The set of strings of 0’s and 1’s such that there are two 0’s separated by a
number of positions that is a multiple of 4. (Note that 0 is an allowable
multiple of 4)
(缺的是非 0 的字符)
c)翻译:有两个 0 被 4 的倍数个数字(0 或者 1 都可以)分开