English

Suffix tree-based linear algorithms for multiple prefixes, single suffix counting and listing problems

Data Structures and Algorithms 2022-04-19 v2

Abstract

Given two strings TT and SS and a set of strings PP, for each string pPp \in P, consider the unique substrings of TT that have pp as their prefix and SS as their suffix. Two problems then come to mind; the first problem being the counting of such substrings, and the second problem being the problem of listing all such substrings. In this paper, we describe linear-time, linear-space suffix tree-based algorithms for both problems. More specifically, we describe an O(T+P)O(|T| + |P|) time algorithm for the counting problem, and an O(T+P+#(ans))O(|T| + |P| + \#(ans)) time algorithm for the listing problem, where #(ans)\#(ans) refers to the number of strings being listed in total, and P|P| refers to the total length of the strings in PP. We also consider the reversed version of the problems, where one prefix condition string and multiple suffix condition strings are given instead, and similarly describe linear-time, linear-space algorithms to solve them.

Keywords

Cite

@article{arxiv.2203.16908,
  title  = {Suffix tree-based linear algorithms for multiple prefixes, single suffix counting and listing problems},
  author = {Laurentius Leonard and Ken Tanaka},
  journal= {arXiv preprint arXiv:2203.16908},
  year   = {2022}
}

Comments

16 pages, 5 figures

R2 v1 2026-06-24T10:33:05.995Z