Data Structure Algorithm, JavaScript, Programming, Software Development, Technology.
building a trie with all the suffixes of the string, and then you start collapsing certain nodes (more on this in a second) to make a smaller, more compact tree. Once it’s ready, the main benefit of using a suffix tree, is that you can find any suffix inside an arbitrarily large string in O(m)