Example #1
0
int main ()
{
	SuffixTree tree ("bibs");
	list<int> indexes = tree.search ("ib");

	for (list<int>::iterator it = indexes.begin(); it != indexes.end(); it++)
	{
		cout << *it << endl;
	}
}
Example #2
0
int main(){
    std::string testString("mississippi");
    std::string stringList[] = {"is", "sip", "hi", "sis"};
    SuffixTree *tree = new SuffixTree(testString);
    for (const auto &x : stringList){
        std::vector<int> list = tree->search(x);
        if (!list.empty()) {
            std::cout << x << ": ";
            for (const auto &y: list){
                std::cout << y << " ";
            }
            std::cout << std::endl;
        }else{
            std::cout << x << ": not found" << std::endl;
        }
    }
}