Questions tagged [suffix-tree]

A suffix tree is a data structure that stores all suffixes of a string. It is the basis for many fast algorithms on strings.

228 questions
1
vote
1 answer

Are the suffix links in a suffix tree same as the failure edges in an aho-corasick automaton?

If so, can someone explain the purposes of suffix links in a suffix tree for exact string matching ?
Jarvis
  • 8,494
  • 3
  • 27
  • 58
1
vote
0 answers

All mutually distinct bitmasks from list

Given a list of strings, I want to find the number of bit-masks, I want to find the number of pairs where bit-mask1 & bit-mask2 = 0. This problem was given in an intra-school contest at my school for class 12 students. I happened to get the question…
Rajarshi basu
  • 330
  • 1
  • 10
1
vote
1 answer

Proof of Suffix tree root edges

I was wondering how to write a proof that the number of branches or root edges in a suffix tree are equal to the size of alphabet of the string S. Say if we have S = {aaabaac}, alphabet={a,b,c}, size of alphabet =3, then the root edges (or branches…
perfecto
  • 63
  • 5
1
vote
1 answer

Building a suffix tree for a string matching algorithm in large database

I had an internship interview last week and I was given a question regarding searching for a particular string in a large database. I was totally clueless about it during the interview though I just gave a reply the"multi-level hashing" as that was…
1
vote
1 answer

Why hidden factor on suffix tree space efficiency is 20?

In general suffix trees are said to be less space efficient than suffix array. More specifically the approximation upper bound O(n) space efficiency hides a factor of 20 compared with that of a suffix array which approximates 4. Why this is…
curious
  • 1,524
  • 6
  • 21
  • 45
1
vote
0 answers

Eclipse Debugger is executing toString() Java method and increasing a static variable

I haven't found a question related with this topic. I'm using this implementation of a Suffix Tree: http://en.literateprograms.org/Suffix_tree_%28Java%29 As you can see in this link, nodes of the tree have a toString() method that calls itself…
Javier Beltrán
  • 128
  • 2
  • 10
1
vote
1 answer

Suffix array labeling internal nodes

Knowing the internal nodes is helpful in a suffix tree, since they can help you solve problems like finding the longest repeating substring. These are hard to construct on the spot (think a whiteboard interview). So people have told me to look into…
ApathyBear
  • 9,057
  • 14
  • 56
  • 90
1
vote
1 answer

How to find the position of a substring in a large string using suffix tree algorithm?

I learned how to implement suffix tree from another stack overflow post. I can only know whether the substring exist of not. I want to know if there is a way to find the location of the sub pattern in the string using the suffix tree.
ChathuraG
  • 160
  • 2
  • 11
1
vote
1 answer

How should I remove all the repeated words and letters of a String?

I am trying to remove every character repeated over 2 times from an extremely long string. So, for example, the word Terrrrrrific becomes Terrific. Now my question is, how do I filter out repeats that include more than a single character the same…
Kanadaj
  • 962
  • 9
  • 25
1
vote
1 answer

Efficient All substring counting in sorted order

You are given a string find the frequency of all substring sorted(decreasing order) according to there frequency. Eg: ababa {"a", "b", "a", "b", "a", "ab", "ba", "ab", "ba", "aba", "bab", "aba", "abab", "baba",…
nil96
  • 313
  • 1
  • 3
  • 12
1
vote
1 answer

How to reverse a suffix tree of a string (findind the string it represents)

Given a (modified/broken) suffix tree, which stores in each edge the beginning and ending of the current substring, but not the substring itself, i.e a suffix tree that looks like this: this tree represents the string "banana" over the alphabet:…
wannabe programmer
  • 653
  • 1
  • 9
  • 23
1
vote
1 answer

Linking in tree structures

Upon working with long strings now, I came across a rather big problem in creating suffix trees in Haskell. Some constructing algorithms (as this version of Ukkonen's algorithm) require establishing links between nodes. These links "point" on a node…
ThreeFx
  • 7,250
  • 1
  • 27
  • 51
1
vote
0 answers

How do I find a pattern with several wildcard strings in a suffix tree?

Let's say that I got a suffix tree ST(T) and a pattern S1 * S2 ... * Sk, whereas * represents any string out of the same alphabet as the strings S1,...,Sk. How do I find the pattern using the indexes of the leaf nodes? My idea for 2 strings S1 and…
tenacious
  • 91
  • 3
  • 11
1
vote
1 answer

Building suffix tree ACB when we already have suffix tree AB

I recently encounter a question about suffix tree. Assume we already have a suffix tree for string S=AB, i.e., S is a concatenation of prefix A and suffix B of S. Now we want to build suffix tree U=ACB. What is the most efficient algorithm for this…
Stone
  • 345
  • 1
  • 6
  • 14
1
vote
2 answers

how to find the indexes of all matching substring using suffix tree?

I created a suffix tree from this amazing answer. It works like a charm! For now, if I look for "cat" in "This cat is a pretty cat", it will return 5 as "cat" first appearance as for starting index 5. But I can't find a way to keep track of all the…
dyesdyes
  • 1,147
  • 3
  • 24
  • 39