![]() |
TheAlgorithms/C++ 1.0.0
All the 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 <cstdint>#include <iostream>#include <cstring>#include <cassert>#include <vector>Go to the source code of this file.
Functions | |
| std::vector< uint64_t > | Z_function (const std::string &pattern) |
| for IO operations | |
| 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. | |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| Main function. | |
The Z function for finding occurences of a pattern within a piece of text with time and space complexity O(n + m)
Definition in file z_function.cpp.
| 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 |
Definition at line 54 of file z_function.cpp.
| int main | ( | void | ) |
Main function.
Definition at line 110 of file z_function.cpp.
|
static |
Self-test implementations.
Definition at line 72 of file z_function.cpp.
| 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 |
Definition at line 29 of file z_function.cpp.