- Author
- Leandro Rabindranath Leon
# include <iostream>
# include <string>
{
const std::string text = "ababa";
std::cout << "Suffix Automaton Example\n";
std::cout << "Text: " << text << "\n";
std::cout <<
"Contains 'bab'? " << (sam.
contains(
"bab") ?
"yes" :
"no") <<
"\n";
const std::string other = "zzabxababa";
std::cout << "LCS(text, '" << other << "') = "
return 0;
}
Suffix structures: suffix array/LCP, suffix tree, suffix automaton.
Suffix automaton (SAM) over byte alphabet.
std::string longest_common_substring(const std::string_view other) const
Find the longest common substring between the built SAM text and other.
void build(const std::string_view text)
Build the SAM from an entire string.
bool contains(const std::string_view pattern) const
Return true if pattern is a substring of the built text.
size_t distinct_substring_count() const
Count the number of distinct substrings in the built text.
size_t state_count() const noexcept
Return the number of states in the SAM.
Main namespace for Aleph-w library functions.