A suffix tree is a data structure that stores all suffixes of a string. It is the basis for many fast algorithms on strings.
Questions tagged [suffix-tree]
228 questions
5
votes
0 answers
Clarification of answer to Stack Overflow post "Ukkonen's suffix tree algorithm in plain English?"
I'm seeking clarification of jogojapan's answer to this question: Ukkonen's suffix tree algorithm in plain English?
Can someone please clarify the following: during step 6 last time the active_point was touched it was set it to (root, 'x', 0)…

some
- 333
- 2
- 7
5
votes
2 answers
Algorithm for 2 Pattern String Matching
I need to code an algorithm for longest two pattern prefix/suffix match whose time complexity is O(n+m1+m2), where n is the length of the String and m1, m2 are the lengths of pattern1 and pattern2 respectively.
Example: if the String is "OBANTAO"…
user3320657
5
votes
1 answer
What is a generalized suffix tree?
I saw the Wikipedia page but still am not clear with the idea.
To find the longest common substring of 2 strings (T and S), I've read that we must build a suffix tree for the string T($1)S($2), where`($1) and ($2) are special characters not part of…

batman
- 5,022
- 11
- 52
- 82
5
votes
1 answer
Suffix tree VS Tries - in plain English , what's the difference?
I've taken a look at this questions , but I still don't see the difference between a Suffix tree and a Trie .
Both have all the substrings of a given string , so where do they differ from one another ?

JAN
- 21,236
- 66
- 181
- 318
5
votes
1 answer
Optimization: Python, Perl, and a C Suffix Tree Library
I've got about 3,500 files that consist of single line character strings. The files vary in size (from about 200b to 1mb). I'm trying to compare each file with each other file and find a common subsequence of length 20 characters between two files.…

mstcamus
- 91
- 4
5
votes
3 answers
How do Suffix Trees work?
I'm going through the data structures chapter in The Algorithm Design Manual and came across Suffix Trees.
The example states:
Input:
XYZXYZ$
YZXYZ$
ZXYZ$
XYZ$
YZ$
Z$
$
Output:
I'm not able to understand how that tree gets…

Anthony
- 33,838
- 42
- 169
- 278
4
votes
3 answers
Suffix tree library for c++ with simple examples how to use it
I'm searching for suffix tree library (that has linear time construction), and all I found is PATL, but PATL has no documentation and I can't figure out any of the examples.
So is there a suffix tree library for c++ that has a decent…

NoSenseEtAl
- 28,205
- 28
- 128
- 277
4
votes
1 answer
suffix trees: locating a substring if a certain number of mistakes are allowed
According to the Wikipedia article on suffix trees, suffix trees can be used to locate substrings of a string if a certain number of mistakes are allowed.
Given the suffix tree of a string, how can I find all the instances of a given substrings of…

Randomblue
- 112,777
- 145
- 353
- 547
4
votes
1 answer
Infer adapter sequence from set of fragments
I have a set S of strings generated from DNA sequencing using a specific adapter fragment. This means that all the strings in S contain a suffix that approximately matches (due to sequencing errors) a prefix of the adapter sequence. How can I, given…

Wims
- 43
- 3
4
votes
1 answer
java pattern matching for first occurrence of pattern s in suffix tree for Mark Nelson’s implementation of Ukkonen’s algorithm
I tried to construct a suffix tree based on Mark Nelson’s implementation of Ukkonen’s algorithm in java code, which is a variant of the code at:
http://www.sanfoundry.com/java-program-implement-suffix-tree/
The following code constructs a compact…

iteong
- 715
- 3
- 10
- 26
4
votes
1 answer
Finding a set of repeated, non-overlapping substrings of two input strings using suffix arrays
Input: two strings A and B.
Output: a set of repeated, non overlapping substrings
I have to find all the repeated strings, each of which has to occur in both(!) strings at least once. So for instance, let
A = "xyabcxeeeyabczeee" and B =…

kafka
- 121
- 6
4
votes
3 answers
Why do we need a sentinel character in a Suffix Tree?
Why do we need to append "$" to the original string when we implement a suffix tree?
user1819636
4
votes
1 answer
Extracting all occurrences of repeated and unique patterns from text, along with context
Say I have the text "abcabx". I would like to know that there is a repeated pattern "ab", all the locations it appears, and how the context of those repetitions relates to its other occurrences. I also want the data structure to have the unique…

user173342
- 1,820
- 1
- 19
- 45
4
votes
2 answers
Ukkonen suffix tree: procedure 'canonize' unclear
How does the 'canonize' function (given below, from Ukkonen's paper) work, and in particular, when is the while loop finished? I think the value of p' - k' will always remain less than that of p - k. Am I right or wrong?
procedure canonize(s, (k,…

Abhishek
- 516
- 1
- 6
- 18
3
votes
1 answer
Returning multiple nodes when searching a tree/trie?
I have constructed a suffix trie, a tree containing all the suffixes of a string, where each node contains only one character, with a SuffixNode at the end of each path which contains the locations of the suffixes within the string.
Let's say my…

Matt
- 3,820
- 16
- 50
- 73