English

Compressed Dictionary Matching on Run-Length Encoded Strings

Data Structures and Algorithms 2025-09-04 v1

Abstract

Given a set of pattern strings P={P1,P2,Pk}\mathcal{P}=\{P_1, P_2,\ldots P_k\} and a text string SS, the classic dictionary matching problem is to report all occurrences of each pattern in SS. We study the dictionary problem in the compressed setting, where the pattern strings and the text string are compressed using run-length encoding, and the goal is to solve the problem without decompression and achieve efficient time and space in the size of the compressed strings. Let mm and nn be the total length of the patterns P\mathcal{P} and the length of the text string SS, respectively, and let m\overline{m} and n\overline{n} be the total number of runs in the run-length encoding of the patterns in P\mathcal{P} and SS, respectively. Our main result is an algorithm that achieves O((m+n)loglogm+occ)O( (\overline{m} + \overline{n})\log \log m + \mathrm{occ}) expected time, and O(m)O(\overline{m}) space, where occ\mathrm{occ} is the total number of occurrences of patterns in SS. This is the first non-trivial solution to the problem. Since any solution must read the input, our time bound is optimal within an loglogm\log \log m factor. We introduce several new techniques to achieve our bounds, including a new compressed representation of the classic Aho-Corasick automaton and a new efficient string index that supports fast queries in run-length encoded strings.

Keywords

Cite

@article{arxiv.2509.03265,
  title  = {Compressed Dictionary Matching on Run-Length Encoded Strings},
  author = {Philip Bille and Inge Li Gørtz and Simon J. Puglisi and Simon R. Tarnow},
  journal= {arXiv preprint arXiv:2509.03265},
  year   = {2025}
}
R2 v1 2026-07-01T05:19:10.338Z