0

I'm just learning suffix trees/tries and trying to at first implement it via some trivial algorithm (non-linear). The trivial algorithm requires adding the suffixes of a string consequently and in some stage, we may have some suffix which will be the prefix of another suffix which requires to traverse this already existing prefix.

For example, there is a string "banana". Here we have the following suffixes:

banana$
anana$
nana$
ana$
na$
a$

Now, let's assume we have added the first 3 suffixes into the tree and currently we need to add ana. This means we need to traverse anana at first and find the longest prefix like ana and then add it. So does this algo require constructing a trie before constructing a tree?

0 Answers0