Expand description
Knuth–Morris–Pratt pattern matching algorithm
Functions§
- kmp_
find - Finds a
needle
in ahaystack
using theKnuth–Morris–Pratt algorithm
. - kmp_
find_ with_ lsp_ table - Finds a
needle
in ahaystack
using theKnuth–Morris–Pratt algorithm
with a givenlongest suffix-prefix
table generated bykmp_table
. - kmp_
match - Matches a
needle
in ahaystack
using theKnuth–Morris–Pratt algorithm
returning a vector of positions in thehaystack
. - kmp_
match_ with_ lsp_ table - Matches a
needle
in ahaystack
using theKnuth–Morris–Pratt algorithm
with a givenlongest suffix-prefix
table generated bykmp_table
and returns a vector of positions in thehaystack
. - kmp_
table - Generate a list of possible fallback positions for the needle, called a
longest suffix-prefix
table. This can also be used if multiple haystacks are to be searched with the same needle, reducing the amount of table generation to one. Functions using this table all end with_with_lsp_table
.