# Construct the Suffix Tree of a String solved by 166

March 18, 2014, 8:26 p.m. by Rosalind Team

Storing Trie(Patterns), which was introduced in “Implement TrieMatching”, requires a great deal of memory. So let’s process Text into a data structure instead. Our goal is to compare each string in Patterns against Text without needing to to traverse Text from beginning to end. In more familiar terms, instead of packing Patterns onto a bus and riding the long distance down Text, our new data structure will be able to “teleport” each string in Patterns directly to its occurrences in Text.



## Sample Output

AAATG$G$
T
ATG$TG$
A
A
AAATG$G$
T
G