OSDN Git Service
(root)
/
oi-wiki
/
main.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fee855a
)
Update ac-automaton.md
author
orzcyand1317
<36555123+orzcyand1317@users.noreply.github.com>
Tue, 5 Mar 2019 11:09:28 +0000
(19:09 +0800)
committer
GitHub
<noreply@github.com>
Tue, 5 Mar 2019 11:09:28 +0000
(19:09 +0800)
docs/string/ac-automaton.md
patch
|
blob
|
history
diff --git
a/docs/string/ac-automaton.md
b/docs/string/ac-automaton.md
index
9486b77
..
47b9927
100644
(file)
--- a/
docs/string/ac-automaton.md
+++ b/
docs/string/ac-automaton.md
@@
-26,14
+26,14
@@
$$
一些细节:走到接受状态之后立即转移到该状态的 $next$ 。
-## AC
算法就是 Trie 上的
自动机
+## AC 自动机
-
注意在 [BFS](/search/bfs) 的同时求出 $trans$ 数组即可
。
+
AC 自动机其实就是 Trie 上的自动机
。
-
可以解决多串匹配问题
。
+
注意在 [BFS](/search/bfs) 的同时求出 $trans$ 数组即可
。
-
注意细节: $O(n+m)$ 还是 $O(n)$,其中 $m$ 表示匹配次数
。
+
AC 自动机一般用来解决多串匹配问题
。
-
前者能找到每次匹配,后者只能求出匹配次数(通过合并接受状态)
。
+
注意细节:AC 自动机的时间复杂度在需要找到所有匹配位置时是 $O(|s|+m)$,其中 $|s|$ 表示文本串的长度,$m$ 表示模板串的总匹配次数;而只需要求是否匹配时时间复杂度为 $O(|s|)$
。
## AC 自动机的实现