54 const std::string
text =
"banana";
57 std::cout <<
"Naive Suffix Tree Example\n";
58 std::cout <<
"Text: " <<
text <<
"\n";
59 std::cout <<
"Node count: " << st.
node_count() <<
"\n\n";
61 const std::string pattern =
"ana";
64 std::cout <<
"Pattern: " << pattern <<
"\n";
65 std::cout <<
"Contains: " << (
not matches.is_empty() ?
"yes" :
"no") <<
"\n";
66 std::cout <<
"Matches at positions: ";
67 for (
size_t i = 0; i <
matches.size(); ++i)
Suffix structures: suffix array/LCP, suffix tree, suffix automaton.
Naive compressed suffix tree (didactic implementation).
Array< size_t > find_all(const std::string_view pattern) const
Return all occurrences of a pattern.
size_t node_count() const noexcept
Return the number of nodes in the tree.
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()
Example program demonstrating construction and queries on a Naive_Suffix_Tree for the string "banana"...