45template <
typename Range>
58 std::cout << label <<
": ";
59 for (
const auto & item :
r)
60 std::cout << std::format(
"{} ", item);
74 const std::string text =
"aabcaabxaaaz";
75 const std::string pattern =
"aab";
80 std::cout << std::format(
"Z-Algorithm Example\nText : {}\nPattern: {}\n\n",
Classical pattern searching algorithms over strings.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
Array< size_t > z_search(const std::string_view text, const std::string_view pattern)
Find all occurrences of a pattern using the Z-algorithm.
Array< size_t > z_algorithm(const std::string_view s)
Compute Z-array for a string.
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.