56 const std::string
text =
"ababa";
60 std::cout <<
"Suffix Automaton Example\n";
61 std::cout <<
"Text: " <<
text <<
"\n";
62 std::cout <<
"States: " <<
sam.state_count() <<
"\n";
63 std::cout <<
"Distinct substrings: " <<
sam.distinct_substring_count() <<
"\n";
64 std::cout <<
"Contains 'bab'? " << (
sam.contains(
"bab") ?
"yes" :
"no") <<
"\n";
66 const std::string
other =
"zzabxababa";
67 std::cout <<
"LCS(text, '" <<
other <<
"') = "
68 <<
sam.longest_common_substring(
other) <<
"\n";
Suffix structures: suffix array/LCP, suffix tree, suffix automaton.
Suffix automaton (SAM) over byte alphabet.
void build(const std::string_view text)
Build the SAM from an entire string.
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
int main()
Demonstrates basic usage of the Suffix_Automaton API with a sample string.