What is suffix trees and suffix arrays?

What is suffix trees and suffix arrays?

A suffix array is a sorted array of all suffixes of a given string. The definition is similar to Suffix Tree which is compressed trie of all suffixes of the given text. In fact Suffix array and suffix tree both can be constructed from each other in linear time.

What is suffix of the array?

In computer science, a suffix array is a sorted array of all suffixes of a string. It is a data structure used in, among others, full text indices, data compression algorithms, and the field of bibliometrics. The suffix array for a subset of all suffixes of a string is called sparse suffix array.

Why would you use a suffix tree data structure over a suffix trie?

If you imagine a Trie in which you put some word’s suffixes, you would be able to query it for the string’s substrings very easily. This is the main idea behind suffix tree, it’s basically a “suffix trie”.

What is suffix tree used for?

In computer science, a suffix tree (also called PAT tree or, in an earlier form, position tree) is a compressed trie containing all the suffixes of the given text as their keys and positions in the text as their values. Suffix trees allow particularly fast implementations of many important string operations.

What does a suffix tree of s look like?

This reduced trie defined over a subset of suffixes of a string s is called a suffix tree of s For better understanding, let’s consider the suffix tree T for a string s = abakan. A word abakan has 6 suffixes {abakan , bakan, akan, kan, an, n} and its suffix tree looks like this:

Can a suffix array be constructed from a suffix tree?

It is also worth to mention, that a suffix array can be constructed directly from a suffix tree in linear time using DFS traversal. Suffix tree can be also constructed from the suffix array and LCP table as described here.

Which is better suffix tree or trie for pattern matching?

A suffix tree T is a natural improvement over trie used in pattern matching problem, the one defined over a set of substrings of a string s. The idea is very simple here.

How are suffix trees used to solve problems?

Suffix trees can solve many complicated problems, because it contain so many information about the string itself. Fo example, in order to know how many times a pattern P occurs in s, it is sufficient to find P in T and return the size of a subtree corresponding to its node.

https://www.youtube.com/watch?v=5-XefX6i4W4