Content-Length: 262330 | pFad | http://github.com/cp-algorithms/cp-algorithms/commit/77549f1e965107b7bc061fff128a7b18094bef34

58 Update aho_corasick.md · cp-algorithms/cp-algorithms@77549f1 · GitHub
Skip to content

Commit 77549f1

Browse files
iamlockonadamant-pwn
authored andcommitted
Update aho_corasick.md
1 parent 8029446 commit 77549f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/string/aho_corasick.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ How can we find out for a state $v$, if there are any matches with strings for t
227227
First, it is clear that if we stand on a $\text{output}$ vertex, then the string corresponding to the vertex ends at this position in the text.
228228
However this is by no means the only possible case of achieving a match:
229229
if we can reach one or more $\text{output}$ vertices by moving along the suffix links, then there will be also a match corresponding to each found $\text{output}$ vertex.
230-
A simple example demonstrating this situation can be creating using the set of strings $\{dabce, abc, bc\}$ and the text $dabc$.
230+
A simple example demonstrating this situation can be created using the set of strings $\{dabce, abc, bc\}$ and the text $dabc$.
231231
232232
Thus if we store in each $\text{output}$ vertex the index of the string corresponding to it (or the list of indices if duplicate strings appear in the set), then we can find in $O(n)$ time the indices of all strings which match the current state, by simply following the suffix links from the current vertex to the root.
233233
This is not the most efficient solution, since this results in $O(n ~ \text{len})$ complexity overall.

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/cp-algorithms/cp-algorithms/commit/77549f1e965107b7bc061fff128a7b18094bef34

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy