In
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, the longest common prefix array (LCP
array
An array is a systematic arrangement of similar objects, usually in rows and columns.
Things called an array include:
{{TOC right
Music
* In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
) is an auxiliary
data structure
In computer science, a data structure is a data organization, management, and storage format that is usually chosen for Efficiency, efficient Data access, access to data. More precisely, a data structure is a collection of data values, the rel ...
to the
suffix 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.
Suffix arrays were introduced by a ...
. It stores the lengths of the longest common prefixes (LCPs) between all pairs of consecutive suffixes in a sorted suffix array.
For example, if ''A'' :=
aab, ab, abaab, b, baab">samp>aab, ab, abaab, b, baabis a suffix array, the longest common prefix between ''A''
=
aab and ''A''
=
ab is
''a'' which has length 1, so ''H''
= 1 in the LCP array ''H''. Likewise, the LCP of ''A''
=
ab and ''A''
=
abaab is
ab, so ''H''
= 2.
Augmenting the suffix array with the LCP array allows one to efficiently simulate top-down and bottom-up
traversals of the
suffix tree
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 parti ...
, speeds up pattern matching on the suffix array and is a prerequisite for compressed suffix trees.
History
The LCP array was introduced in 1993, by
Udi Manber
Udi Manber ( he, אודי מנבר) is an Israeli computer scientist. He is one of the authors of agrep and GLIMPSE. After a career in engineering and management, he worked on medical research.
Education
He earned both his bachelor's degree in 1 ...
and
Gene Myers alongside the suffix array in order to improve the running time of their string search algorithm.
Definition
Let
be the
suffix 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.
Suffix arrays were introduced by a ...
of the string
of length
, where
is a sentinel letter that is unique and
lexicographically
In mathematics, the lexicographic or lexicographical order (also known as lexical order, or dictionary order) is a generalization of the alphabetical order of the dictionaries to sequences of ordered symbols or, more generally, of elements of ...
smaller than any other character. Let