Sliding Window String Indexing in Streams
Abstract
Given a string over an alphabet , the 'string indexing problem' is to preprocess to subsequently support efficient pattern matching queries, i.e., given a pattern string report all the occurrences of in . In this paper we study the 'streaming sliding window string indexing problem'. Here the string arrives as a stream, one character at a time, and the goal is to maintain an index of the last characters, called the 'window', for a specified parameter . At any point in time a pattern matching query for a pattern may arrive, also streamed one character at a time, and all occurrences of within the current window must be returned. The streaming sliding window string indexing problem naturally captures scenarios where we want to index the most recent data (i.e. the window) of a stream while supporting efficient pattern matching. Our main result is a simple space data structure that uses time with high probability to process each character from both the input string and the pattern string . Reporting each occurrence from uses additional constant time per reported occurrence. Compared to previous work in similar scenarios this result is the first to achieve an efficient worst-case time per character from the input stream. We also consider a delayed variant of the problem, where a query may be answered at any point within the next characters that arrive from either stream. We present an space data structure for this problem that improves the above time bounds to . In particular, for a delay of we obtain an space data structure with constant time processing per character. The key idea to achieve our result is a novel and simple hierarchical structure of suffix trees of independent interest, inspired by the classic log-structured merge trees.
Cite
@article{arxiv.2301.09477,
title = {Sliding Window String Indexing in Streams},
author = {Philip Bille and Johannes Fischer and Inge Li Gørtz and Max Rishøj Pedersen and Tord Joakim Stordalen},
journal= {arXiv preprint arXiv:2301.09477},
year = {2023}
}