Internal Dictionary Matching
arXiv:1909.11577
Abstract
We introduce data structures answering queries concerning the occurrences of patterns from a given dictionary in fragments of a given string of length . The dictionary is internal in the sense that each pattern in is given as a fragment of . This way, takes space proportional to the number of patterns rather than their total length, which could be . In particular, we consider the following types of queries: reporting and counting all occurrences of patterns from in a fragment and reporting distinct patterns from that occur in . We show how to construct, in time, a data structure that answers each of these queries in time . The case of counting patterns is much more involved and needs a combination of a locally consistent parsing with orthogonal range searching. Reporting distinct patterns, on the other hand, uses the structure of maximal repetitions in strings. Finally, we provide tight---up to subpolynomial factors---upper and lower bounds for the case of a dynamic dictionary.
A short version of this paper was accepted for presentation at ISAAC 2019