[Paper Review] Linear-Space Substring Range Counting over Polylogarithmic Alphabets
This paper presents a linear-space data structure for substring range counting over strings with polylogarithmic alphabets, achieving optimal O(m) query time when u = n·polylog(n), improving upon prior O(n log n / log log n) space bounds. It leverages suffix trees, predecessor data structures, and partial-sum structures to efficiently count pattern occurrences within labeled position intervals, enabling optimal bounds for position-restricted substring counting and related problems.
Bille and Gørtz (2011) recently introduced the problem of substring range counting, for which we are asked to store compactly a string $S$ of $n$ characters with integer labels in ([0, u]), such that later, given an interval ([a, b]) and a pattern $P$ of length $m$, we can quickly count the occurrences of $P$ whose first characters' labels are in ([a, b]). They showed how to store $S$ in $\Oh{n \log n / \log \log n}$ space and answer queries in $\Oh{m + \log \log u}$ time. We show that, if $S$ is over an alphabet of size (\polylog (n)), then we can achieve optimal linear space. Moreover, if (u = n \polylog (n)), then we can also reduce the time to $\Oh{m}$. Our results give linear space and time bounds for position-restricted substring counting and the counting versions of indexing substrings with intervals, indexing substrings with gaps and aligned pattern matching.
Motivation & Objective
- Address the space and time inefficiency of prior substring range counting solutions that require O(n log n / log log n) space.
- Achieve linear space (O(n)) for strings over polylogarithmic alphabets, which is optimal under standard assumptions.
- Reduce query time to O(m) when the label universe size u is n·polylog(n), matching the pattern length.
- Extend the solution to support counting variants of indexing substrings with intervals, gaps, and aligned pattern matching.
- Provide a practical and efficient framework for position-restricted substring counting with optimal space and time complexity.
Proposed method
- Construct a suffix tree over the string S with integer-labeled characters in [0, u].
- At each internal node, store a string of labels of characters immediately following occurrences of the substring represented by that node.
- Use a predecessor data structure (Theorem 3.2) to answer rank and select queries on label intervals in O(1) or O(log log u) time.
- Maintain a partial-sum data structure to compute the range of labels in [a,b] within each node’s label string.
- Descend the suffix tree from the root to the locus of the pattern P, maintaining the interval of valid occurrences at each level.
- Use rank queries at each node to compute the interval of labels in [a,b] for the current substring, and propagate the interval size to the next level.
Experimental results
Research questions
- RQ1Can substring range counting be solved in linear space when the alphabet size is polylogarithmic in n?
- RQ2Is it possible to achieve O(m) query time for substring range counting when u = n·polylog(n)?
- RQ3Can the linear-space solution be extended to other problems like position-restricted substring counting and indexing with intervals or gaps?
- RQ4What are the space-time trade-offs when u is larger than n·polylog(n), and can we still achieve near-optimal performance?
- RQ5Is it possible to achieve both linear space and linear query time when u is unrestricted, or is this fundamentally limited?
Key findings
- For strings over a polylogarithmic alphabet, the proposed data structure uses only O(n) space, achieving optimal linear space complexity.
- When u = n·polylog(n), the query time is reduced to O(m), which is optimal for pattern length and improves upon the prior O(m + log log u) bound.
- The solution supports counting occurrences of any pattern P whose first character’s label lies in [a,b], with efficient interval propagation through the suffix tree.
- The method enables optimal bounds for position-restricted substring counting, counting versions of indexing substrings with intervals and gaps, and aligned pattern matching.
- The approach uses a combination of suffix trees, predecessor data structures, and partial-sum structures to maintain O(1) or O(log log u) time per rank query.
- The framework can also return an example occurrence in O(m) time by climbing the suffix tree and using select queries, with additional O(n) space for position mapping.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.