###
Implementing the LZ-index: Theory versus Practice

####
Gonzalo Navarro

The LZ-index is a theoretical proposal of a lightweight data structure for
text indexing, based on the Ziv-Lempel trie. If a text of *u* characters
over an alphabet of size *s* is compressible to *n* symbols using
the LZ78 algorithm, then the LZ-index takes *4n log_2(n) (1+o(1))* bits
of space (that is, 4 times the entropy of the text) and reports the *R*
occurrences of a pattern of length *m* in worst case time *O(m^3 log(s)
+ (m+R) log n)*. In this paper
we face the challenge of obtaining a practical implementation of the LZ-index,
which is not at all straightforward from the theoretical proposal. We end
up with a prototype that takes the promised space and has average search time
*O(s m log(u) + sqrt(uR))*. This prototype is shown to be faster
than other competing approaches when we take into account the time to report
the
positions or text contexts of the occurrences found. We show in detail the
process of implementing the index, which involves interesting lessons of
theory
versus practice.