Trie and Suffix Trees
Trie and Suffix Trees
DSA
Module 3
An introduction to string matching
String matching is an important branch of algorithm, and it has applications in many fields, as:
Text searching
Molecular biology
Data compression
and so on…
Exact String Matching
Locating a given pattern in a string and standard solutions
2. If P is a suffix of S
◦ NO ouotgoing edge, not a suffix
◦ If path till you reach a leaf, then a suffix
◦ Eg : baa; not a suffix
A generalized suffix tree is simply a ST for a set of strings, each one ending with a
different marker. The leafs have two numbers, one identifiing the string and the other
identifiing the position inside the string. c$
ab
c# (1,4)
b
S1 = abbc$ (2,2)
(2,4)
bc$
(1,1)
abc#
c$
S2 = babc#
bc$ (2,1)
(1,3)
(2,3)
(1,2)
Generalized
Suffix Trees