|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Illustrative example for Z-algorithm pattern matching. More...
Go to the source code of this file.
Functions | |
| template<typename Range > | |
| void | print_range (std::string_view label, const Range &r) |
| Print a label followed by the elements of a range to standard output. | |
| int | main () |
| Example program demonstrating computation of the Z-array and pattern matches using the Z-algorithm. | |
Illustrative example for Z-algorithm pattern matching.
Definition in file z_algorithm_example.cc.
| int main | ( | ) |
Example program demonstrating computation of the Z-array and pattern matches using the Z-algorithm.
Computes the Z-array for a sample text and finds all match positions of a sample pattern, then prints the text, pattern, Z-array, and match positions to standard output.
0 on success. Definition at line 72 of file z_algorithm_example.cc.
References Aleph::divide_and_conquer_partition_dp(), print_range(), Aleph::z_algorithm(), and Aleph::z_search().
| void print_range | ( | std::string_view | label, |
| const Range & | r | ||
| ) |
Print a label followed by the elements of a range to standard output.
Each element is formatted with std::format using the {} format specifier, separated by spaces, and the output is terminated with a newline.
| Range | Type of the range; must be iterable. |
| label | Prefix text printed before the range elements. |
| r | The range whose elements will be printed; element type must be formattable with std::format. |
Definition at line 56 of file z_algorithm_example.cc.
References r.
Referenced by main().