Crate kmp

Source
Expand description

Knuth–Morris–Pratt pattern matching algorithm

Functions§

kmp_find
Finds a needle in a haystack using the Knuth–Morris–Pratt algorithm.
kmp_find_with_lsp_table
Finds a needle in a haystack using the Knuth–Morris–Pratt algorithm with a given longest suffix-prefix table generated by kmp_table.
kmp_match
Matches a needle in a haystack using the Knuth–Morris–Pratt algorithm returning a vector of positions in the haystack.
kmp_match_with_lsp_table
Matches a needle in a haystack using the Knuth–Morris–Pratt algorithm with a given longest suffix-prefix table generated by kmp_table and returns a vector of positions in the haystack.
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.