Nearly Optimal Internal Dictionary Matching
Abstract
We study the internal dictionary matching (IDM) problem where a dictionary containing substrings of a text is given, and each query concerns the occurrences of patterns in in another substring of . We propose a novel -sized data structure named Basic Substring Structure (BASS) where is the length of the text With BASS, we are able to handle all types of queries in the IDM problem in nearly optimal query and preprocessing time. Specifically, our results include: The first algorithm that answers the CountDistinct query in time with preprocessing, where we need to compute the number of distinct patterns that exist in . Previously, the best result was time per query after or preprocessing, where is a chosen parameter. Faster algorithms for two other types of internal queries. We improve the runtime for (1) Occurrence counting (Count) queries to time per query with preprocessing from time per query with preprocessing. (2) Distinct pattern reporting (ReportDistinct) queries to time per query from per query. In addition, we match the optimal runtime in the remaining two types of queries, pattern existence (Exists), and occurrence reporting (Report). We also show that BASS is more generally applicable to other internal query problems.
Cite
@article{arxiv.2312.11873,
title = {Nearly Optimal Internal Dictionary Matching},
author = {Jingbang Chen and Jiangqi Dai and Qiuyang Mang and Qingyu Shi and Tingqiang Xu},
journal= {arXiv preprint arXiv:2312.11873},
year = {2025}
}
Comments
25 pages