These two concepts are frequently seen in string matching issues:
Text: Original
Template (pattern): keyword (equivalent to a substring)
Task: Find pattern in text
Common algorithms:
AC Automata: Multiple pattern
KMP: Known pattern, preprocessing of pattern
Trie: Also known as a prefix tree, often used to find string prefixes
Suffix array: Known text, preprocessing of text
Suffix tree: In fact, the path is compressed version of the trie tree, the tree does not have a forked path compressed
-----------------------------------------------------------------
Sa[i]: suffix array, all suffixes of the pattern are sorted from small to large, and the beginning position of the first suffix (total n suffixes, sa[0..n-1]) is ordered.
Eg: for the word "banana", sa={5,3,1,0,4,2}, respectively, corresponding to the suffix A, ana, Anana, Banana, NA, nana
Rank[i]: Save Sa[i] rank from small to large in all suffixes
Sa[i] and rank[i] reciprocal, namely sa[rank[i]]=i, rank[sa[i]]=i
Defines the longest common prefix length for height[i]=sa[i-1] and Sa[i] (that is, the longest common prefix length for two ranked adjacent suffixes)
Suffix Array notes