English

Online algorithms for finding distinct substrings with length and multiple prefix and suffix conditions

Data Structures and Algorithms 2022-11-01 v3

Abstract

Let two static sequences of strings PP and SS, representing prefix and suffix conditions respectively, be given as input for preprocessing. For the query, let two positive integers k1k_1 and k2k_2 be given, as well as a string TT given in an online manner, such that TiT_i represents the length-ii prefix of TT for 1iT1 \leq i \leq |T|. In this paper we are interested in computing the set ansi\mathit{ans_i} of distinct substrings ww of TiT_i such that k1wk2k_1 \leq |w| \leq k_2, and ww contains some pPp \in P as a prefix and some sSs \in S as a suffix. More specifically, the counting problem is to output ansi|\mathit{ans_i}|, whereas the reporting problem is to output all elements of ansi\mathit{ans_i}, for each iteration ii. Let σ\sigma denote the alphabet size, and for a sequence of strings AA, A=uAu\Vert A\Vert=\sum_{u\in A}|u|. Then, we show that after O((P+S)logσ)O((\Vert P\Vert +\Vert S\Vert)\log\sigma)-time preprocessing, the solutions for the counting and reporting problems for each iteration up to ii can be output in O(Tilogσ)O(|T_i| \log\sigma) and O(Tilogσ+ansi)O(|T_i| \log\sigma + |\mathit{ans_i}|) total time. The preprocessing time can be reduced to O(P+S)O(\Vert P\Vert +\Vert S\Vert) for integer alphabets of size polynomial with regard to P+S\Vert P\Vert +\Vert S\Vert. Our algorithms have possible applications to network traffic classification.

Keywords

Cite

@article{arxiv.2207.04194,
  title  = {Online algorithms for finding distinct substrings with length and multiple prefix and suffix conditions},
  author = {Laurentius Leonard and Shunsuke Inenaga and Hideo Bannai and Takuya Mieno},
  journal= {arXiv preprint arXiv:2207.04194},
  year   = {2022}
}

Comments

14 pages (including references and appendix), 3 figures, 1 table

R2 v1 2026-06-25T00:46:36.073Z