|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
The Z function for finding occurences of a pattern within a piece of text with time and space complexity O(n + m) More...
#include <iostream>#include <cstring>#include <cassert>#include <vector>Functions | |
| std::vector< uint64_t > | Z_function (const std::string &pattern) |
| for IO operations More... | |
| std::vector< uint64_t > | find_pat_in_text (const std::string &pattern, const std::string &text) |
| Using Z_function to find a pattern in a text. More... | |
| static void | test () |
| Self-test implementations. More... | |
| int | main () |
| Main function. More... | |
The Z function for finding occurences of a pattern within a piece of text with time and space complexity O(n + m)
| std::vector< uint64_t > find_pat_in_text | ( | const std::string & | pattern, |
| const std::string & | text | ||
| ) |
Using Z_function to find a pattern in a text.
| [in] | pattern | string pattern to search |
| [in] | text | text in which to search |
| int main | ( | void | ) |
|
static |
Self-test implementations.
| std::vector< uint64_t > Z_function | ( | const std::string & | pattern | ) |
for IO operations
for string for assert for std::vector
Generate the Z-function for the inputted string.
| [in] | pattern | text on which to apply the Z-function |