Abstract 1 Introduction 2 Preliminaries 3 Restricted Recompression in Sublinear Time 4 Computing 𝝉-Runs in Sublinear Time 5 String Synchronizing Sets in Sublinear Time 6 Improving the Query Time References

Time-Optimal Construction
of String Synchronizing Sets

Jonas Ellert ORCID DIENS, École normale supérieure de Paris, PSL Research University, France Tomasz Kociumaka ORCID Max Planck Institute for Informatics, Saarland Informatics Campus, Saarbrücken, Germany
Abstract

A powerful design principle behind many modern string algorithms is local consistency: breaking the symmetry between string positions based on their small contexts so that matching fragments are handled consistently. Among the most influential instantiations of this principle are string synchronizing sets [Kempa & Kociumaka; STOC 2019]. A τ-synchronizing set of a string of length n is a set of O(n/τ) string positions, chosen using their length-2τ contexts, such that (outside of highly periodic regions) every block of τ consecutive positions contains at least one element of the set. Synchronizing sets have found dozens of applications in diverse settings, from quantum and dynamic algorithms to fully compressed computation. In the classic word RAM model, particularly for strings over small alphabets, they enabled faster solutions to core problems in data compression, text indexing, and string similarity.

In this work, we show that any string T[0..σ)n can be preprocessed in O(nlogσ/logn) time so that, for any given integer τ[1..n], a τ-synchronizing set of T can be constructed in O((nlogτ)/(τlogn)) time. Both bounds are optimal in the word RAM model with machine word size w=Θ(logn), matching the information-theoretic minimum for the input and output sizes, respectively. Previously, constructing a τ-synchronizing set required O(n/τ) time after an O(n)-time preprocessing [Kociumaka, Radoszewski, Rytter, and Waleń; SICOMP 2024], or, in the restricted regime of τ<0.2logσn, without any preprocessing needed [Kempa & Kociumaka; STOC 2019].

A simple instantiation of our method outputs the synchronizing set as a sorted list in O(n/τ) time, or as a bitmask in O(n/logn) time. Our optimal construction produces a compact fully indexable dictionary, supporting select queries in O(1) time and rank queries in O(log(logτloglogn)) time. The latter complexity matches known unconditional cell-probe lower bounds for τn1Ω(1).

To achieve this, we introduce a general framework for efficiently processing sparse integer sequences via a custom variable-length encoding. We also augment the optimal variant of van Emde Boas trees [Pătraşcu & Thorup; STOC 2006] with a deterministic linear-time construction. When the set is represented as a bitmask under our sparse encoding, the same guarantees for select and rank queries hold after preprocessing in time proportional to the size of our encoding (in words).

Keywords and phrases:
synchronizing sets, local consistency, packed strings
Funding:
Jonas Ellert: Partially funded by grant ANR20-CE48-0001 from the French National Research Agency.
Copyright and License:
[Uncaptioned image] © Jonas Ellert and Tomasz Kociumaka; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Pattern matching
Related Version:
Full Version: https://arxiv.org/abs/2602.11324
Editors:
Meena Mahajan, Florin Manea, Annabelle McIver, and Nguyễn Kim Thắng

1 Introduction

In many string processing tasks, one can afford a relatively costly preprocessing for a small fraction of positions in the input string. The choice of these positions often governs how useful the preprocessing is. The most natural selection mechanisms rely only on the length n of the input string and the “selection rate” 1τ; this includes selecting multiples of τ, sampling positions uniformly at random, as well as difference covers [31]. Although these simple mechanisms are sufficient in some scenarios, the principle of a locally consistent selection has enabled a myriad of new applications. Here, the idea is to select a position i based on the symbols at the nearby positions, without looking at the integer i itself. This ensures that any two positions are handled in the same way whenever they appear in the same context.

The concept of local consistency can be traced back to Sahinalp and Vishkin’s locally consistent parsing [38, 39, 40]. Further hierarchical parsing mechanisms appeared in [11, 12, 19, 20, 32]. Their drawback is that the context size is typically bounded in terms of the number of fixed-level phrases of the parsing, which can vary between regions of the string.

Local consistency is also frequently used in applied research, especially bioinformatics, where minimizers [36, 41] are the most popular mechanism. Here, the context size is easily controlled, but the number of selected positions is known to be 𝒪(n/τ) only for random strings.

String synchronizing sets [22] are a relatively recent local consistency mechanism that addresses the two issues with previous alternatives, paving the way for many more applications (see a dedicated paragraph near the end of this section). A τ-synchronizing set for a length-n string T is a set 𝖲𝗒𝗇𝖼[0..n2τ] satisfying two conditions: The consistency condition states that, if two positions i,j share their size-𝒪(τ) contexts (formalized as T[i..i+2τ)=T[j..j+2τ)), then either both positions are synchronizing (i,j𝖲𝗒𝗇𝖼) or neither of them is (i,j𝖲𝗒𝗇𝖼). The density condition requires that, among every τ consecutive positions in T, at least one belongs to 𝖲𝗒𝗇𝖼, except in highly periodic regions of T (see Definition 5.1 for a formal definition). The central contribution of Kempa and Kociumaka [22] is that every length-n string T admits, for every positive integer τ<12n, a τ-synchronizing set of size 𝒪(n/τ) that can be constructed deterministically in 𝒪(n) time. This construction uses sliding window minima, similarly to how minimizers are defined.

The original motivation for string synchronizing sets was to efficiently process strings over small alphabets of size σ=no(1). In this regime, one can store Θ(logσn)=ω(1) symbols in a single machine word (integer variable) of Θ(logn) bits, which allows solving problems in o(n) time, e.g., in 𝒪(n/logσn) time, proportional to the size of the input in machine words. The main algorithms of [22] utilize τ-synchronizing sets for a small τ=Θ(logσn), which are built in 𝒪(n/logσn) time. More generally, [22] provides an 𝒪(n/τ)-time τ-synchronizing set construction for every τ<15logσn by adapting the 𝒪(n)-time construction for arbitrary τ.

Several further works [2, 8, 28] rely on a hierarchy of τ-synchronizing sets constructed for different values of τ. Kociumaka, Radoszewski, Rytter, and Waleń [28] build such a hierarchy using a novel construction algorithm based on restricted recompression, a locally consistent parsing scheme that modifies recompression by Jeż [19, 20]. After an 𝒪(n)-time preprocessing, their algorithm constructs a τ-synchronizing set (given any τ) in 𝒪(n/τ) time.

While the two existing constructions have already been very impactful, several natural questions remain open, limiting further use cases. The following is perhaps the simplest one:

Can one construct a small τ-synchronizing set in o(n) time if τlogσn and σ=no(1)?

In general, we can ask for a single construction algorithm subsuming the two current methods:

Is there an algorithm that, after 𝒪(n/logσn)-time preprocessing of a given string, allows constructing a τ-synchronizing set in 𝒪(n/τ) time for any given τ<12n?

The first main result of this work, presented in Sections 3, 4, and 5, answers both questions positively:

Theorem 1.1 (Simplified version of Theorem 5.3).

A string T[0..σ)n can be preprocessed in 𝒪(n/logσn) time so that, given τ12n, a τ-synchronizing set 𝖲𝗒𝗇𝖼 of T of size |𝖲𝗒𝗇𝖼|<70nτ can be constructed in 𝒪(nτ) time.

Our algorithm returns 𝖲𝗒𝗇𝖼 as a sorted list, but the same techniques allow returning 𝖲𝗒𝗇𝖼 as a bitmask in 𝒪(n/logσn) time, which is faster when τ=o(logσn); see Theorem 5.4.

While these two representations are compact (asymptotically optimal up to a constant factor) for 𝒪(n/τ)-size subsets when τ=nΩ(1) and τ=𝒪(1), respectively, we can hope for a smaller representation and a faster construction algorithm for intermediate values of τ. We address this in Section 6, where we provide an 𝒪(nlogττlogn)-time algorithm that outputs a representation supporting efficient select and rank queries (asking for the r-th smallest synchronizing position and the number of synchronizing positions smaller than i, respectively).

Theorem 1.2 (Simplified version of Corollary 6.20).

A string T[0..σ)n can be preprocessed in 𝒪(n/logσn) time so that, given τ12n, a τ-synchronizing set 𝖲𝗒𝗇𝖼 of T of size |𝖲𝗒𝗇𝖼|<70nτ can be constructed in 𝒪(nlogττlogn) time. The set is reported in an 𝒪(nlogττ)-bit representation that supports select queries in 𝒪(1) time and rank queries in 𝒪(loglogτloglogn) time.

As discussed in Lemma 6.1, our representation size is asymptotically optimal. Hence, the preprocessing time and the construction time are also optimal for the machine word size of Θ(logn) bits. The time complexity of rank queries reduces to constant time for τ=log𝒪(1)n and matches the unconditional lower bound of Pătraşcu and Thorup [33] for τn1Ω(1).

Our Techniques.

The algorithm behind Theorem 1.1 builds upon the construction of [28]. For this, in Section 3, we show how to implement restricted recompression in 𝒪(n/logσn) time. During the first K=Θ(loglogσn) rounds, we simulate restricted recompression on every possible length-𝒪(logσn) context and keep track of how many times each context occurs in the input string. In the remaining rounds, we process each phrase in constant time. What enables such an approach is that the context size in the k-th round of restricted recompression is bounded by 𝒪(λk) and the number of phrases is 𝒪(n/λk), where λk=2Θ(k).

Before we can derive Theorem 1.1 in Section 5, we also need a data structure for reporting runs (maximal periodic fragments) in the input string, which we present in Section 4.

Upon a transition from Theorem 1.1 to Theorem 1.2, several seemingly simple steps become difficult to implement. The prevailing challenge is to process sparse integer sequences in o(1) time per non-zero entry. Our strategy is to introduce a variable-length encoding of such sequences, implement operations on them using transducers (finite automata with output tapes), and provide a general method for speeding up transducer execution using precomputed tables. We believe that our approach, outlined in Section 6, will be useful in many other contexts to efficiently manipulate compact data representations.

In particular, in order to provide rank and select support in Theorem 1.2, we provide a new compact variant of van Emde Boas trees [42] matching the optimal query time bounds of Pătraşcu and Thorup [33] and, unlike existing variants, constructible deterministically in linear time.

Theorem 1.3.

Let S[0..2) of size |S|=n with 2 and n,22𝒪(w) be given as an array of -bit integers in increasing order. For mn, let a=lg(m/n)+lgw. A deterministic data structure that answers rank and predecessor queries in 𝒪(lglgma) time can be built in 𝒪(m) time and words of space.

If the input set is provided using our sparse representation, we even achieve construction time proportional to the number of machine words in the compact encoding of the set (and, in many cases, sublinear in the number of set elements); see Section 6.3.

Applications of Synchronizing Sets.

Since their introduction in 2019, string synchronizing sets have found numerous applications across a variety of settings. For strings over small alphabets, they enabled o(n)-time algorithms for fundamental decades-old tasks such as Burrows–Wheeler transform [22], Lempel–Ziv factorization [15, 26], and the longest common factor problem [8]. They are also behind the only o(n)-time constructions of compact suffix array and suffix tree representations [25] and data structures for longest common extension (LCE) [22, 13] and internal pattern matching (IPM) [28] queries. Further applications include detecting regularities in strings, such as palindromes [10], squares [9], and covers [35].

In some applications, including IPM queries [28] and the longest common factor with mismatches problem [8], string synchronizing sets also enabled speed-ups for large alphabets. In certain cases, such as for the longest common circular factor problem [2], the obtained speed-up is as large as from 𝒪(n2) to 𝒪(nlog𝒪(1)n). Polynomial-factor speed-ups also arise beyond the classic setting, thanks to adaptations of synchronizing sets (with custom constructions) to the dynamic [23], quantum [1, 21], and fully-compressed [24, 26] settings.

Other Local Consistency Mechanisms.

There are dozens of local consistency mechanisms with different features and use cases. Beyond those mentioned above, theoretical methods include sample assignments [27] and the partitioning sets [6], which predate synchronizing sets. In the algorithm engineering community, beyond minimizers (see [17, Chapter 6] for a very recent literature overview), notable alternatives include locally consistent anchors [30, 3] and the prefix-free parsing [7], which is particularly useful in the context of suffix sorting.

2 Preliminaries

For i,j, we write [i..j]=[i..j+1)=(i1..j]=(i1..j+1) to denote {hihj}. We also write lgi to denote log2max(1,i). A string T of length |T|=n over alphabet [0..σ) is a sequence of n symbols from [0..σ). For i,j[0..n), the i-th symbol is T[i], and the sequence T[i]T[i+1]T[j] is denoted by T[i..j]=T[i..j+1) (which is the empty string if i>j). For i,j[0..n), consider T[i..j]. We may interpret T[i..j] and T[i..j] as substrings. We then write T[i..j]T[i..j] and say that the substrings match if and only if ji=ji and h[0..ji]T[i+h]=T[i+h]. We can choose to interpret them as fragments instead, in which case we write T[i..j]=T[i..j] and say that the fragments are equal if and only if i=i and j=j (or if both fragments are empty). For fragments T[i..j] and T[i..j], we denote their intersection as T[i..j]T[i..j]=T[max(i,i)..min(j,j)].

The concatenation of two strings T[0..n) and S[0..m) is defined as TS:=T[0]T[n1]S[0]S[m1], and the k-times concatenation of T with itself is written as Tk, where k0. Note that T0 is the empty string. The unique primitive root R of a non-empty string T is the shortest prefix of T such that there is k+ with T=Rk.

Model of Computation.

We assume the word RAM model (see, e.g., [18]) with words of w=Θ(lgn) bits when processing a text T[0..σ)n with σn𝒪(1). The text and all other strings encountered throughout the paper are assumed to be in lgσ-bit representation, i.e., each symbol uses exactly lgσ bits, the entire text occupies Θ(nlgσ) consecutive bits of memory, and each memory word fits Θ(logσn) symbols. Using arithmetic and bitwise operations, we can extract any substring of length up to logσn in a single word in 𝒪(1) time.

In the analysis, σ will only appear when the claimed (pre-)processing time is 𝒪(n/logσn). For obtaining these results, we assume that lgσ, that the symbol $:=σ1 does not occur in T[0..n), and that we have access to the lgσ-bit representation of T[n..2n):=$nT[0..n)$n. This assumption is without loss of generality, which we show in the complete version.

Accessing lookup tables with substrings.

We will use substrings of length at most (logσn)/4 to access lookup tables. For a string S[0..σ) of length 0|S|(logσn)/4, we define its integer representation int(S) as follows:

  • int(S) consists of 2(lgn)/4 bits, i.e., int(S)[0..22(lgn)/4)[0..n).

  • The upper half of int(S) contains the binary representation of S (consisting of |S|lgσ(lgn)/4 bits), padded with 0-bits.

  • The lower half of int(S) stores the length |S|. This value can indeed be stored in lg(1+(logσn)/4)<(lgn)/4 bits. (The inequality holds if n exceeds some constant.)

As mentioned earlier, extracting a substring S=T[i..j) of length 0ji(logσn)/4 takes constant time. Mapping S to int(S) and vice versa also takes constant time.

2.1 Revisiting Restricted Recompression

Following [28], we define integer sequences (λk)k=0 so that λk=(87)k/2 and (αk)k=0 so that α0=1 and recursively αk=αk1+λk1. These sequences control, respectively, the phrase lengths and context sizes at each recompression round. As observed in [28], αk+116λk holds for every k0. Our goal is to compute the following sets:

Proposition 2.1 ([28, Propositions 3.4 and 4.7]).

For every length-n text T, there exists a descending chain [1..n)=B0B1Bq= with q=𝒪(lgn) such that, for each k0, the set Bk satisfies the following:

  1. (a)

    |Bk|4nλk

  2. (b)

    For i,j[αk..nαk], if iBk and T[iαk..i+αk)T[jαk..j+αk), then jBk.

  3. (c)

    If i,j are consecutive positions in Bk{0,n}, then T[i..j) has length at most 74λk, or its primitive root has length at most λk.

If T[0..n𝒪(1))n, then one can construct B0Bq1Bq= in 𝒪(n) time.

 Remark 2.2.

While q=𝒪(lgn) is not stated in [28, Propositions 3.4 and 4.7], it readily follows from Proposition 2.1(a), in which we have Bk= if λk>4n (see also [28, p. 1542]).

Our sublinear-time solution for the initial rounds of restricted recompression closely follows the structure of the linear-time algorithm in the proof of Proposition 2.1 (see [28, Proposition 4.7]). We now give a conceptual description of this algorithm (ignoring implementation details). If we can show that the new solution is functionally identical to this algorithm, then it correctly computes the sets satisfying Proposition 2.1.

We start with the set B0=[1..n). Assume that, for some k[0..q), we have computed the set Bk={f1,,fm} with f1<f2<<fm. Let f0=0 and fm+1=n, and define Fi=T[fi..fi+1) for i[0..m]. Now we compute the set Bk+1.

Case 1: 𝒌 is even.

For each i[1..m], we add fi to Bk+1 if and only if max(|Fi1|,|Fi|)>λk or Fi1Fi (or both). This can be viewed as merging each run of identical phrases (of length at most λk) into a single new phrase (see Figure 1(a)).

(a) Construction of Bk+1 for even k. Equal labels indicate matching substrings. In this example, F is the only phrase of length more than λk before constructing Bk+1.
 
(b) Construction of Bk+1 for odd k. Equal labels indicate matching substrings. In this example, F is the only phrase of length more than λk before constructing Bk+1. White, gray, and green blocks respectively correspond to phrases in L, phrases in R, and merged phrase pairs.
 
(c) Multigraph (left) and weighted graph (right) for the factorization from Figure 1(b), where |E|=11 and the sum of weights from L to R is 5.
Figure 1: Even and odd rounds of restricted recompression.

Case 2: 𝒌 is odd.

Let ={Fii[0..m] and |Fi|λk} be the set of distinct phrases of length at most λk, viewed as strings rather than fragments (so matching phrases represent the same element of ). We partition into sets L and R. For each i[1..m], we add fi to Bk+1 unless both Fi1L and FiR. This amounts to merging adjacent pairs of phrases whenever the left phrase is in L and the right phrase is in R (see Figure 1(b)).

The sets L,R are computed by modeling the factorization as a directed multigraph whose nodes are the elements of . For every i[1..m], we add an edge from Fi1 to Fi if max(|Fi1|,|Fi|)λk. (Due to the preceding even round, it is clear that Fi1Fi.) Let E be the multiset of all edges. To obtain the properties in Proposition 2.1, it suffices to partition into L and R so that at least 14|E| edges go from L to R. This can be achieved by approximating a maximum directed cut in the multigraph (e.g., using [28, Lemma A.1]).

Equivalently, we can use a weighted directed graph instead of a multigraph. The set of nodes is still . For each pair of nodes F,F′′, the weight of the edge from F to F′′ is the number of edges from F to F′′ in the multigraph. Then, we partition into L and R so that the sum of the weights of edges from L to R is at least 14|E| (see Figure 1(c)).

3 Restricted Recompression in Sublinear Time

In this section, we show how to implement restricted recompression in 𝒪(n/logσn) time. If logσn is constant, then we can afford linear time and use the solution from [28]. Hence, assume logσn256. We fix K:=2log8/7(2561logσn). Recalling that λK=(87)K/2, we observe that 782561logσnλK2561logσn. During rounds 0,,K of restricted recompression, by Proposition 2.1(b), the phrase boundaries are chosen based on short contexts of length at most 2αK32λK81logσn, and hence this process can be accelerated using word-packing techniques. After round K, the number of boundary positions is at most 4nλK=𝒪(n/logσn) by Proposition 2.1(a), and we can implement the remaining rounds in 𝒪(n/logσn) time using the linear-time solution presented in [28]. We only need the following straightforward corollaries.

Definition 3.1.

Let Bk={f1,,fm}[1..n) with f1<f2<<fm be one of the sets computed in Proposition 2.1, and let f0=0 and fm+1=n. We define

  • the (not necessarily unique) string of phrase names Ik[0..m] over alphabet [0..m], where, for every i,j[0..m], it holds Ik[i]=Ik[j] if and only if T[fi..fi+1)T[fj..fj+1),

  • the array lenk[0..m] of phrase lengths with lenk[i]=fi+1fi for all i[0..m].

Corollary 3.2 (of [28, Proposition 4.7]).

Let k[0..q). Given Bk, Ik, and lenk, one can compute Bk+1Bk+2Bq1Bq= in 𝒪(n/λk) time.

Proof.

The algorithm from the proof of [28, Proposition 4.7] uses Bk,Ik, and lenk to compute Bk+1,Ik+1, and lenk+1 in 𝒪(|Bk|) time. Hence, the remaining sets Bk+1Bk+2Bq= can be computed in 𝒪(k=kq1|Bk|) time. By Proposition 2.1(a) and the definition of λk, the sum is bounded by 𝒪(n/λk).

Corollary 3.3.

Given the elements of BK in increasing order, one can compute the sets BK+1BK+2Bq1Bq= in 𝒪(n/logσn) time.

Proof.

Let BK={f1,,fm} with fi<fi+1 for all i[1..m), and define f0=0 and fm+1=n. Note that m=𝒪(n/λK)=𝒪(n/logσn) by Proposition 2.1(a) and the definitions of K and λK. By Corollary 3.2, it suffices to compute IK and lenK in 𝒪(n/λK) time, which is trivial for lenK. To compute IK, we first produce a string IK over a slightly larger alphabet. For each i[0..m], we encode phrase T[fi..fi+1) as IK[i]=(int(Si),lenK[i]), where Si is the truncated phrase T[fi..min(fi+1,fi+2λK)). Trivially, two phrases are identical if and only if they have the same length and primitive root. By Proposition 2.1(c), the primitive root of any phrase is of length at most 74λK. Since Si is either the entire phrase or a length-2λK prefix of the phrase, it is also a (possibly fractional) power of the primitive root of the phrase. Hence, it is easy to see that we indeed encode two phrases identically if and only if they are identical. Clearly, IK can be computed in 𝒪(m) time. We obtain IK by reducing the alphabet to [0..m] using radix sort in 𝒪(n/logσn) time.

3.1 Performing the Initial 𝑲 Rounds

In the initial rounds of recompression, the weights in the graph of adjacent phrases depend on the abundance of short substrings. Hence, we use the following simple index for counting short substrings. A proof is provided in the full version.

Lemma 3.4.

For any string T[0..σ)n, in 𝒪(n/logσn) time, we can construct a data structure that answers the following type of query in constant time. Given a string S[0..σ) of length at most (logσn)/8, return the number of occurrences of S in T.

Defining phrase boundaries via substrings.

Instead of directly computing Bk, we compute the intermediate representation111Recall that T is padded so that T[n..2n)=$nT[0..n)$n. Hence, T[iαk..i+αk) with i[0..n] is always defined. Also, if i[0..n][αk..nαk], then T[iαk..i+αk) is unique in T[αk..n+αk). Ck={T[iαk..i+αk)iBk{0,n}}, i.e., rather than explicitly listing the boundary positions, we instead list the set of distinct contexts that cause a boundary. From now on, for k[0..q] and iBk, we say that a string T[iαk..i+αk)Ck is a boundary context of Bk. For every i[0..n], it follows from Proposition 2.1(b) that iBk{0,n} if and only if T[iαk..i+αk)Ck.

Lemma 3.5.

The sets C1,,CK1,CK can be computed in 𝒪(n/logσn) time, with each set Ck encoded as a bitmask of length n whose set bits are {int(S):SCk}.

Proof.

The sets C1,,CK1,CK consist of strings of length up to 2αK81logσn. We can encode any SCk as int(S)[0..n). We construct the data structure from Lemma 3.4 for the padded string $2αKT$2αK, which allows querying for S. We can also query for strings of the form $j1T[0..j2) and T[nj1..n)$j2 with j1+j22αK.

Initialization.

We initialize each of C1,,CK as an all-zero bitmask of length n. Recall that α0=1. For computing C0, we enumerate all possible length-two strings over [0..σ), except for $2. For each such string S, we query the data structure from Lemma 3.4. If S occurs in T, we set the int(S)-th bit of C0 to one. Recall that 22αK81logσn; hence, we can indeed afford to enumerate all strings of length up to 2αK (e.g., the σ2 strings of length two during initialization) in 𝒪(22αK)𝒪(n) time.

Preparing round 𝒌+𝟏.

Assume that we have already computed Ck for some k[0..K), and our goal is to compute Ck+1. The main computational challenge is the following. For each length-2αk+1 string S over alphabet [0..σ), except for $2αk+1, we have to decide if SCk+1. We enumerate all the 𝒪(n) possible strings of length 2αk+1. For each such string S, we first check if it is indeed a substring of the padded string T using the data structure from Lemma 3.4. If S is not a substring, then it is not a boundary context of Bk+1 and can be skipped. Otherwise, we consider its central part S=S[αk+1αk..αk+1+αk). If S is not a boundary context of Bk, i.e., if SCk (a check performed in constant time), then S cannot be a boundary context of Bk+1 due to Bk+1Bk. Hence, if SCk, we do not have to process S any further.

If, however, it holds SCk, then we have to decide whether we will make S a boundary context of Bk+1 by adding S to Ck+1. For the sake of explanation, consider any position i[1..n) such that T[iαk+1..i+αk+1)S. We now explain how to compute the minimal values ,r[1..λk] such that iBk{0,n} and i+rBk{0,n}. If both values exist, then the factorization induced by Bk contains fragments T[i..i) and T[i..i+r) as phrases. If, however, or r does not exist, then we know that the phrase ending at position i1 or the phrase starting at position i is of length more than λk (possibly both). When creating Bk+1, the algorithm from [28, Proposition 4.7(a)] (see also Section 2.1) merges two adjacent phrases only if both of them are of length at most λk. Hence, if or r does not exist, then the phrases around boundary i cannot be merged, and i is a boundary position in Bk+1.

We now explain how to compute or show that it does not exist; the computation for r is symmetric. Consider any [1..λk]. Due to αk+1=αk+λk and ST[iαk+1..i+αk+1), it holds

T[iαk..i+αk)S[λk..λk+2αk).

Hence, we can check if i is in Bk{0,n} by probing Ck with S[λk..λk+2αk) in constant time. By trying all possible values, finding the minimal suitable takes 𝒪(λk) time. If both and r exist, then we add a tuple S,,r to a list . Otherwise, as explained above, we have to make S a boundary context of Bk+1 by adding S to Ck+1.

After processing all possible strings S, we have the following situation. If a boundary position in Bk{0,n} is adjacent to a phrase of length over λk, then the corresponding boundary context has been added to Ck+1. (This is always the case for the contexts $αk+1T[0..αk+1) and T[nαk+1..n)$αk+1 of positions 0 and n, respectively). If a boundary position in Bk has context S and is adjacent to phrases of respective lengths ,rλk, then S,,r has been added to . Since each context has been added to at most once, the elements of are distinct.

Performing an even round.

Consider a boundary position in Bk for which the two adjacent phrases are identical and of length at most λk. The run of identical phrases will be merged in Bk+1, and the boundary position will no longer exist. Hence, we proceed as follows. We consider each element S,,r of the list . If S[αk+1..αk+1)S[αk+1..αk+1+r), then we add S to Ck+1; otherwise, we do nothing (skip the element of ).

Performing an odd round.

We have to produce the weighted directed graph described in Section 2.1. The set of nodes is =S,,r{S[αk+1..αk+1),S[αk+1..αk+1+r)}.

For each S,,r, we obtain the number s of occurrences of S in the padded T using the data structure from Lemma 3.4. We increase the weight of the edge from S[αk+1..αk+1) to S[αk+1..αk+1+r) by s. (This results in no self-loops, as phrases in are of length λk, and runs of phrases of length λk have been eliminated in the preceding even round.) Observe that ||=𝒪(n), and each element of contributes weight to one edge. Therefore, the number of edges is 𝒪(n), and we can approximate the maximum cut in 𝒪(n) time (see, e.g., [28, Lemma A.1], which immediately works for weighted graphs). This reveals the two parts L and R used for computing Bk+1. We once more consider each S,,r and check if S[αk+1..αk+1)L and S[αk+1..αk+1+r)R. Whenever this is the case, we do nothing (skip the element of ). Otherwise, we add S to Ck+1.

Time complexity and correctness.

In each round, we have to consider all the 𝒪(n) possible strings of length 2αk+1. We process each string in 𝒪(λk)𝒪(lgn) time, dominated by the time needed to compute and r. We spend additional 𝒪(n) time to approximate the maximum cut. Recalling that K=𝒪(loglogn), the overall time is 𝒪(Knlgn)o(n/lgn), plus 𝒪(n/logσn) time for the preprocessing of Lemma 3.4. The correctness follows from the fact that the algorithm directly implements the steps described in Section 2.1.

3.2 Reporting the Phrase Boundaries

The number of boundaries in the initial K rounds may significantly exceed 𝒪(n/logσn), and thus we cannot afford to report them explicitly. Instead, we report a bitmask of length n that marks the boundaries.

Lemma 3.6.

For an integer 1(logσn)/8, consider a set 𝒞[0..σ). Given a text T[0..σ)n and an 𝒪(1)-time membership oracle to 𝒞, a bitmask representing {i[0..n]:T[i..i+)𝒞} can be constructed in 𝒪(n/logσn) time.

Proof.

First, we construct an array B[0..n) so that, for each string U of length |U|2(logσn)/4, the entry B[int(U)] is a bitmask of length |U|+1 representing {i[0..|U|]:U[i..i+)𝒞}. Due to constant-time oracle access to 𝒞, the construction of B takes 𝒪(n)=𝒪~(n) time.

Next, for each j[0..n/), we extract a string Tj=T[j..min(j+21,n)). In other words, this is a decomposition of T into substrings of length 21 (with the last one of length between and 21) overlapping by exactly 1 positions. Finally, we construct the resulting bitmask by concatenating the bitmasks B[int(Tj)] for subsequent indices [0..n/). This is valid because, for each i[0..n], we have T[i..i+)=Ti/[imod..imod+) and the concatenated bitmasks are of length exactly (except for the last one, whose length is between 1 and ).

The well-known folklore Lemma below efficiently transforms a bitmask into an explicit set; a proof is provided for completeness.

Lemma 3.7.

Given a bitmask M of length n, the set {i[0..n)M[i]=1} can be output in increasing order in 𝒪(n/lgn+i=0n1M[i]) time.

Proof.

We use a lookup table L[0..2lgn/2), where entry L[x] contains a list of the one-bits in the binary representation of x in left to right order. Clearly, the table can be computed in 𝒪~(n) time. Then, we can process the mask M in chunks of size lgn/2 (padding the final chunk with zeros). For each chunk, we look up the list of one-bits and report them after applying the appropriate offset. This takes 𝒪(n/lgn+i=0n1M[i]) time.

Lemma 3.8.

Given T[0..σ)n and a parameter k0, a set Bk (represented as a bitmask) satisfying the conditions of Proposition 2.1 can be constructed in 𝒪(n/logσn) time.

Proof.

If kK, the set Ck constructed in the proof of Lemma 3.5 serves as an 𝒪(1)-time membership oracle to the set of boundary contexts. We then convert Ck to Bk using Lemma 3.6 on the text $αkT$αk, discarding the initial and final value (corresponding to positions 0 and n). (Lemma 3.6 marks the leftmost position of each boundary context occurrence, and contexts are of length 2αk; since position i in $αkT$αk corresponds to position iαk in T, the reported positions are the central positions of boundary contexts in T, as required.) If k>K, we first construct the bitmask for BK and then convert it into an explicit list of positions with Lemma 3.7. Then, we use Corollary 3.3 to obtain Bk in explicit representation in 𝒪(n/logσn) time, which we convert back into a bitmask in 𝒪(n/logn+|Bk|) time. Due to |Bk||BK|=𝒪(n/logσn), the time is as claimed.

Lemma 3.9.

A text T[0..σ)n can be preprocessed in 𝒪(n/logσn) time so that, given k0, a set Bk satisfying the conditions of Proposition 2.1 can be constructed in 𝒪(1+n/λk) time. The elements of Bk are reported from left to right.

Proof.

For kK, we can simply use Lemmas 3.8 and 3.7, which takes 𝒪(n/logσn+|Bk|)=𝒪(n/λk) time. For all k>K, the sets can be computed during preprocessing as follows. We compute BK in explicit representation using Lemmas 3.8 and 3.7. Then, we obtain all the remaining sets using Corollary 3.3.

4 Computing 𝝉-Runs in Sublinear Time

An integer p[1..|S|] is a period of a string S if S[i]=S[i+p] holds for each i[0..|S|p). We denote the smallest period of a non-empty string S by 𝗉𝖾𝗋(S), and we call S periodic whenever 𝗉𝖾𝗋(S)12|S|.

A run (a maximal repetition) in a string T is a periodic fragment γ=T[i..j) of T that can be extended neither to the left nor to the right without increasing the smallest period p=𝗉𝖾𝗋(γ), i.e., i=0 or T[i1]T[i+p1], and j=n or T[j]T[jp]. The set of all runs in T is denoted by 𝖱𝖴𝖭𝖲(T). Crucially, the periodicity lemma [16] implies that distinct runs cannot overlap too much.

Fact 4.1 ([29, Lemma 1(ii)]).

Let γ,γ𝖱𝖴𝖭𝖲(T) be distinct yet overlapping runs in a string T. If p=𝗉𝖾𝗋(γ) and p=𝗉𝖾𝗋(γ), then |γγ|<p+pgcd(p,p).

Among many consequences of ˜4.1 is that every periodic fragment T[i..j) can be uniquely extended to a run T[i..j)𝖱𝖴𝖭𝖲(T) such that iijj and 𝗉𝖾𝗋(T[i..j))=𝗉𝖾𝗋(T[i..j)). We denote this unique extension by 𝗋𝗎𝗇(T[i..j)). If T[i..j) is not periodic, we write 𝗋𝗎𝗇(T[i..j))= to indicate that the run extension is undefined.

Theorem 4.2 ([28, Theorem 1.5]).

A text T[0..σ)n can be preprocessed in 𝒪(n/logσn) time so that, given a fragment x of T, the run extension γ=𝗋𝗎𝗇(x) can be computed in 𝒪(1) time. If γ, then the query algorithm also returns the shortest period 𝗉𝖾𝗋(γ)=𝗉𝖾𝗋(x).

For ,p[0..n], we write 𝖱𝖴𝖭𝖲,p(T)={γ𝖱𝖴𝖭𝖲(T):|γ| and 𝗉𝖾𝗋(γ)p}. The construction of string synchronizing sets relies on τ-runs defined for τ[1..n] as

𝖱𝖴𝖭𝖲τ(T)=𝖱𝖴𝖭𝖲τ,τ/3(T).
Proposition 4.3.

One can preprocess a text T[0..σ)n in 𝒪(n/logσn) time so that, given integers ,p[0..n] with 2p, one can output the set 𝖱𝖴𝖭𝖲,p(T) in 𝒪(n/(+12p)) time. The runs are reported together with their periods and simultaneously ordered by their start and end positions.

Proof.

In the preprocessing phase, we construct the data structure of Theorem 4.2. At query time, if p=0, then we trivially return the empty set. Otherwise, we pick Δ=+12p and, for i[0..(n2p)/Δ], consider fragments Ti=T[iΔ..iΔ+2p). For each Ti, we compute γi=𝗋𝗎𝗇(Ti) and output γi as long as γi, |γi|, and γiγi1 (or i=0). The query time is clearly 𝒪(n/Δ)=𝒪(n/(+12p)). Correctness is easy to verify; for completeness, a proof is provided in the full version.

Lemma 4.4.

For a text T of length n and integers ,p[1..n], define

𝖱,p(T)={i[0..n]:𝗉𝖾𝗋(T[i..i+))p}.

If 2p, then

𝖱𝖴𝖭𝖲,p(T)={T[b..e):[b..e] is a maximal interval contained in 𝖱,p(T)}.

Proof.

Consider γ=T[b..e)𝖱𝖴𝖭𝖲,p(T). For each i[b..e], the fragment T[i..i+) is contained in γ, and thus 𝗉𝖾𝗋(T[i..i+))𝗉𝖾𝗋(γ)p. Consequently, [b..e]𝖱,p(T).

Next, for a proof by contradiction, suppose that b1𝖱,p(T). This means that 𝗉𝖾𝗋(T[b1..b+1))p and thus γ=𝗋𝗎𝗇(T[b1..b+1))𝖱𝖴𝖭𝖲,p(T). The fragment T[b..b+1) is contained in both γ and γ, so the intersection of these two runs consists of at least 12p1𝗉𝖾𝗋(γ)+𝗉𝖾𝗋(γ)gcd(𝗉𝖾𝗋(γ),𝗉𝖾𝗋(γ)) positions. This contradicts ˜4.1, and thus b1𝖱,p(T). A symmetric argument shows that e+1𝖱,p(T).

It remains to prove that every maximal interval [i..j]𝖱,p(T) corresponds to a run T[i..j+)𝖱𝖴𝖭𝖲,p(T). Since i𝖱,p(T), we have 𝗉𝖾𝗋(T[i..i+))p, and thus γ=𝗋𝗎𝗇(T[i..i+))𝖱𝖴𝖭𝖲,p(T). Denote γ=T[b..e); as previously shown, [b..e] is a maximal interval contained in 𝖱,p(T). Since i[b..e] holds due to bi and ei+ and since [i..j] is also a maximal interval contained in 𝖱,p(T), we conclude that [i..j]=[b..e], i.e., T[b..e)=T[i..j+) holds as claimed.

Proposition 4.5.

Given a string T[0..σ)n and parameters ,p[0..(logσn)/8], the bitmask 𝖱,p(T) can be constructed in 𝒪(n/logσn) time.

Proof.

Observe that, in 𝒪~(n) time, we can construct a bitmask of length n whose set bits are {int(R):R[0..σ) and 𝗉𝖾𝗋(R)p}. This gives us constant-time oracle access to the set {R[0..σ):𝗉𝖾𝗋(R)p}. Now, Lemma 3.6 lets us construct in 𝒪(n/logσn) time a bitmask representing 𝖱,p(T)={i[0..n]:𝗉𝖾𝗋(T[i..i+))p}. The overall running time is 𝒪~(n)+𝒪(n/logσn)=𝒪(n/logσn).

5 String Synchronizing Sets in Sublinear Time

Definition 5.1 (Synchronizing set [22]).

For a string T[0..n) and parameter τ[1..n/2], a set 𝖲𝗒𝗇𝖼[0..n2τ] is a τ-synchronizing set of T if it satisfies the following two conditions:

Consistency:

For i,j[0..n2τ], if i𝖲𝗒𝗇𝖼 and T[i..i+2τ)T[j..j+2τ), then j𝖲𝗒𝗇𝖼.

Density:

For i[0..n3τ+1], we have [i..i+τ)𝖲𝗒𝗇𝖼= if and only if 𝗉𝖾𝗋(T[i..i+3τ1))13τ.

Proposition 5.2 ([28, Construction 3.5 and Lemma 5.2]).

For a string T[0..n), let (Bk)k0 be a descending chain satisfying Proposition 2.1. Consider a parameter τ[1..n/2].

Define a set 𝖲𝗒𝗇𝖼[0..n2τ] so that a position i[0..n2τ] belongs to 𝖲𝗒𝗇𝖼 if and only if 𝗉𝖾𝗋(T[i..i+2τ))>13τ and at least one of the following conditions holds:

  • i+τBk(τ), where k(τ)=max{j0j=0 or 16λj1τ};

  • there exists a τ-run T[b..e)𝖱𝖴𝖭𝖲τ(T) such that b=i+1; or

  • there exists a τ-run T[b..e)𝖱𝖴𝖭𝖲τ(T) such that e=i+2τ1.

Then, 𝖲𝗒𝗇𝖼 is a τ-synchronizing set of size |𝖲𝗒𝗇𝖼|<70nτ.

Theorem 5.3 (Compare [28, Theorem 1.13]).

A string T[0..σ)n can be preprocessed in 𝒪(n/logσn) time so that, given τ[1..n/2], a τ-synchronizing set 𝖲𝗒𝗇𝖼 of T of size |𝖲𝗒𝗇𝖼|<70nτ can be constructed in 𝒪(nτ) time. Moreover, 𝗉𝖾𝗋(T[i..i+2τ))>13τ holds for every i𝖲𝗒𝗇𝖼.

Proof.

We build 𝖲𝗒𝗇𝖼 based on the construction specified in Proposition 5.2. At preprocessing time, we build an array of intervals I[0..k(n)] with I[k]={τ:k(τ)=k}. Note that I[0]=[0..16λ0) and I[k]=[16λk1..16λk) for k[1..k(n)]. Since k(n)=𝒪(lgn) and the values λj can be computed in 𝒪(1) time each (using constant-time arithmetic operations on 𝒪(lgn)-bit integers), this preprocessing takes 𝒪(lgn) time. We also apply the 𝒪(n/logσn)-time preprocessing of Lemmas 3.9 and 4.3.

Given τ, we first compute k(τ) by scanning I[0..k(n)] from the top down to find the largest k with τI[k]. This takes 1+k(n)k(τ)=1+𝒪(lgnτ)=𝒪(nτ) time. Next, we apply Lemma 3.9 to generate Bk(τ) in 𝒪(1+n/λk(τ))=𝒪(n/τ) time, where the definition of k(τ) implies 16λk(τ)>τ. Then, we use Proposition 4.3 to compute 𝖱𝖴𝖭𝖲τ(T), with runs simultaneously ordered by their start and end positions; this also takes 𝒪(n/τ) time. Finally, we proceed exactly as in the proof of [28, Theorem 1.13], where it is shown how to derive 𝖲𝗒𝗇𝖼 from Bk(τ) and 𝖱𝖴𝖭𝖲τ(T) in 𝒪(n/τ) time.

Theorem 5.4.

Given a string T[0..σ)n and a parameter τ[1..n/2], a τ-synchronizing set 𝖲𝗒𝗇𝖼 of T of size |𝖲𝗒𝗇𝖼|<70nτ, represented as a bitmask, can be constructed in 𝒪(n/logσn) time. Moreover, 𝗉𝖾𝗋(T[i..i+2τ))>13τ holds for every i𝖲𝗒𝗇𝖼.

Proof.

If τ(logσn)/16, we apply Theorem 5.3 with preprocessing followed by a single query. In 𝒪(n/logσn+n/τ)=𝒪(n/logσn) time, this yields the explicit representation of the set 𝖲𝗒𝗇𝖼 satisfying the desired conditions. We convert this set into a bitmask by starting with an all-0 bitmask and setting the i-th bit for every i𝖲𝗒𝗇𝖼. This conversion also takes 𝒪(n/logσn+n/τ)=𝒪(n/logσn) time.

In the complementary case of τ<(logσn)/16, we first compute k(τ) in 𝒪(lgn) time by naively iterating over all possibilities. Then, we apply Lemma 3.8 to compute a bitmask representing Bk(τ) and Proposition 4.5 to compute bitmasks representing 𝖱2τ,τ/3(T) and 𝖱τ,τ/3(T); both subroutines take 𝒪(n/logσn) time. According to Proposition 5.2, a synchronizing set satisfying the desired conditions can be obtained by including a position i if and only if 𝗉𝖾𝗋(T[i..i+2τ))>τ/3 (which is equivalent to i𝖱2τ,τ/3(T)) and at least one of the following conditions hold:

  • i+τBk(τ),

  • there exists a τ-run T[b..e)𝖱𝖴𝖭𝖲τ(T) such that b=i+1 (which, by Lemma 4.4, is equivalent to i𝖱τ,τ/3(T) and i+1𝖱τ,τ/3(T)),

  • there exists a τ-run T[b..e)𝖱𝖴𝖭𝖲τ(T) such that e=i+2τ1 (which, by Lemma 4.4, is equivalent to i+τ𝖱τ,τ/3(T) and i+τ1𝖱τ,τ/3(T)).

Consequently, the bitmask representing 𝖲𝗒𝗇𝖼 can be computed using 𝒪(1) bitwise operations (AND, OR, NOT) applied to the following components: 𝖱2τ,τ/3; the mask Bk(τ) shifted by τ positions and padded with 0-bits; and four copies of 𝖱τ,τ/3, shifted and padded as follows – by 0 positions with 1-bits, by 1 position with 0-bits, by τ1 positions with 0-bits, and by τ positions with 1-bits. All these bit-wise operations, including shifts and padding, can be implemented in 𝒪(n/lgn) time, giving a total time of 𝒪(n/logσn).

6 Improving the Query Time

In the remainder of the paper, we further improve the query time for synchronizing set construction from 𝒪(nτ) to 𝒪(nlgττlgn), while retaining the 𝒪(n/logσn) preprocessing time. We only outline the main algorithmic ideas here, with proofs of all claims in the full version.

The synchronizing set will be output in a representation of size 𝒪(nlgττ) bits. We show that this is optimal in the lemma below, which models the query algorithm as a function mapping an input string T into an encoding 𝖤(T) of a τ-synchronizing set 𝖲𝗒𝗇𝖼 of T such that 𝖲𝗒𝗇𝖼 can be recovered from 𝖤(T) alone using an accompanying decoding function 𝖣.

Lemma 6.1.

Consider integers n,τ+ such that n3τ, as well as a pair of functions 𝖤:{0,1}n{0,1} and 𝖣:{0,1}2[0..n) jointly satisfying the following property:

For every T{0,1}n, the set 𝖣(𝖤(T)) is a τ-synchronizing set of T.

Then, there exists T{0,1}n such that |𝖤(T)|=Ω(nτlgτ).

Proof.

Let k=n3τ. For an arbitrary string S[0..τ)k, we construct T{0,1}n defined by i[0..k)T[3τi..3τi+3τ):=02τ+S[i]110τS[i], with an arbitrary suffix T[3τk..n). For any τ-synchronizing set, the first synchronizing position in [3τi..3τi+3τ) is 3τi+S[i]. This holds due to Proposition 5.2 and the fact that T[3τi..3τi+2τ+S[i]1) is a suffix of a τ-run. Hence, given any τ-synchronizing set of T, we can restore S. Consequently, over all the S[0..τ)k, the average size of the encoded set is at least klgτ=Ω(nτlgτ) bits.

Sparse encodings.

Our representation of the constructed τ-synchronizing set is its bitmask in a special sparse encoding. During the construction, we also encode intermediate integer arrays, and hence we give a more general definition. The encoding is based on Elias-γ codes:

Definition 6.2 (Elias-γ code [14]).

The Elias-γ code of a positive integer x+ is a bitmask γ(x):=𝟶X[0..], where =lgx and X[0..] is the (+1)-bit binary representation of x (with most significant bit X[0]=𝟷).

Definition 6.3 (Sparse encoding).

The sparse encoding of a string A0n is a bitmask 𝗌𝗉¯𝖾𝗇𝖼(A) that encodes A from left to right as follows. Each symbol u+ is stored as a literal token 𝟷γ(u). Each inclusion-wise maximal fragment of the form 0x for x+ is stored as a zero-run token 𝟶γ(x).

Example 6.4.

Consider string A=000300500000009100=033025079102 and its sparse encoding shown below. The first bit of each token indicates whether it is a literal x or a zero-run 0x. The rest of the token consists of lgx zeros (to the left of each dotted line) and the binary representation of x (to the right of each dotted line).

We note that a zero-run 0x or a literal x>0 contributes 2lgx+2 bits to the encoding. By applying Jensen’s inequality to the concave log-function, we get the following bounds.

Observation 6.5.

For A0n, let i1<i2<<ia be the elements of {i[0..n)A[i]0}, and let i0=1 and ia+1=n. Regarding |𝗌𝗉¯𝖾𝗇𝖼(A)|, we observe:

  • The number of bits contributed by zero-run tokens is at most

    2a+2+j=0a2lg(ij+1ij)𝒪((a+1)lgn+1a+1)𝒪(n).
  • The number of bits contributed by literal tokens is exactly

    2a+j=1a2lgA[ij]𝒪(j=0n1lg(1+A[j]))𝒪(alg(1aj=1aA[ij])).
  • If i=0n1A[i]𝒪(n), then |𝗌𝗉¯𝖾𝗇𝖼(A)|𝒪((a+1)lgn+1a+1).

If we encode the bitmask of a synchronizing set from Theorem 5.4, then the encoding consists of 𝒪(|𝖲𝗒𝗇𝖼|lgn|𝖲𝗒𝗇𝖼|)=𝒪(nτlgτ) bits. It is easy to see that the size of the encoding is minimized when the string A is all-zero, in which case it consists of 2lgn+2 bits.

Observation 6.6.

For every n+ and A0n, it holds 2lgn<|𝗌𝗉¯𝖾𝗇𝖼(A)|.

If a string A is a prefix of another string A, then the sparse encoding of A is also a prefix of the sparse encoding of A, unless A ends with a zero-run that can be extended further in A. In the latter case, the zero-run is encoded differently in A and A. Since the set of Elias-γ codes (and hence the set of possible tokens) is prefix-free, this implies that the encoding of A cannot be a prefix of the encoding of A.

Observation 6.7.

The following holds for every two distinct non-empty strings A,A0+. The encoding 𝗌𝗉¯𝖾𝗇𝖼(A) is a prefix of the encoding 𝗌𝗉¯𝖾𝗇𝖼(A) if and only if A is a prefix of A and A[|A|1..|A|]00.

Parsing sparse encodings.

We introduce basic tools for sparse encodings. Computing Elias-γ codes can be accelerated with precomputed lookup tables. Then, we can encode and decode strings one token at a time, resulting in Lemma 6.9 below. For Lemma 6.9(ii), we merely split the computation time of Lemma 6.9(i) into preprocessing and query time.

Lemma 6.8.

For every N[2..2w], after an 𝒪(N)-time preprocessing, the following holds for every u𝒪(w) and x[1..2u). Computing B:=γ(x) from the u-bit representation of x and computing the u-bit representation of x from a bitmask with prefix B can be done in 𝒪(1+lgx/lgN) time. The size |B|=2lgx+1 of the code is also reported.

Lemma 6.9.

For every N[2..2w], after an 𝒪(N)-time preprocessing, the following holds for every u𝒪(w). Let A[0..2u)n with n2𝒪(w).

  1. (i)

    Computing the u-bit representation of A from 𝗌𝗉¯𝖾𝗇𝖼(A) and vice versa can be done in 𝒪(n+|𝗌𝗉¯𝖾𝗇𝖼(A)|/lgN) time.

  2. (ii)

    If A is given in u-bit representation, then in 𝒪(n) time and space, one can compute a data structure that returns 𝗌𝗉¯𝖾𝗇𝖼(A) in 𝒪(1+|𝗌𝗉¯𝖾𝗇𝖼(A)|/lgN) time.

We can encode and decode sparse arrays (in list representation) in constant time per non-zero entry, using Lemma 6.8 to process one token at a time.

Corollary 6.10.

After an 𝒪(n)-time preprocessing, given any array A[0..n𝒪(1)]n as a list of its a[0..n] non-zero entries as position-value pairs in increasing order of position, we can output 𝗌𝗉¯𝖾𝗇𝖼(A) and vice versa in 𝒪(1+a) time.

6.1 Processing Sparse Encodings With Transducers

We will repeatedly process bitmasks, strings, and arrays in the sparse encoding. As a general tool for this task, we propose a preprocessing scheme for deterministic finite-state transducers, henceforth simply called transducers. A transducer consists of a finite set Q of states, an initial state s0Q, a finite alphabet Σ, and a transition function δ:Q×ΣtQ×Σ. Given input strings S1,,St, the transducer produces output string T, where all strings are of common length n and are over alphabet Σ. The computation is performed in a sequence of n steps. Before the i-th step (with i[0..n)), the transducer is in state si, and it has already written T[0..i). The i-th step is performed by evaluating δ(si,S1[i],,St[i])=(si+1,T[i]), resulting in the new state and the next symbol of the output string. Since the input strings are processed from left to right, we say that the transducer has t input streams, and we call it a single-stream transducer if t=1.

In the Theorem below, we show how to preprocess a single-stream transducer so that it can efficiently work directly on sparse encodings. For every state s and every string S for which |𝗌𝗉¯𝖾𝗇𝖼(S)| is at most a small fraction of lgN, we precompute the entire chain of transitions performed when reading S in state s. The result of this precomputation is the new state reached after reading S, as well as the sparse encoding of the produced output. This way, for a longer input encoding, we can process up to Ω(lgN) bits in constant time.

Theorem 6.11.

Consider a single-stream transducer over alphabet [0..σ) with states [0..q), where σ,q2𝒪(w). For every N[2..2w], if evaluating the transition function with input symbol x (at any state) takes 𝒪(1+lg(1+x)/lgN) time, then after an 𝒪(qN)-time preprocessing, the following holds.

If S is an input string of length n2𝒪(w) for which the transducer produces output T, then 𝗌𝗉¯𝖾𝗇𝖼(T) can be computed from 𝗌𝗉¯𝖾𝗇𝖼(S) in 𝒪(1+(|𝗌𝗉¯𝖾𝗇𝖼(S)|+|𝗌𝗉¯𝖾𝗇𝖼(T)|)/lgN) time.

Proof sketch.

We follow the full proof in the full version. Fix a small constant ε>0 and set M=Θ(Nε) to be a power of two (so lgM=Θ(lgN)). The proof has two parts: (i) tabulate how the transducer behaves on all sparse encodings whose bit-length is lgM, and (ii) process the remaining long tokens (especially long zero-runs) with a separate jumping mechanism.

Preprocessing.

We precompute information that lets us process Ω(lgM) bits of the input encoding in 𝒪(1) time.

  1. 1.

    Tabulating short prefixes of sparse encodings. For every state s[0..q) we build a lookup table Ls indexed by all bitmasks B{0,1}lgM. For each B, we find the largest prefix length blgM such that B[0..b) is a sparse encoding. Let A be the decoded length-a string with B[0..b)=𝗌𝗉¯𝖾𝗇𝖼(A). We simulate the transducer for a steps on input A, obtaining the new state s and the produced output string A. We then store in Ls[int(B)] (besides b,a,s) a representation of 𝗌𝗉¯𝖾𝗇𝖼(A) that separates leading and trailing zeros: we keep the counts z1,z2 of leading/trailing zeros of A, and build the data structure D from Lemma 6.9(ii) for the middle part A[z1..az2). This way, later we can append 𝗌𝗉¯𝖾𝗇𝖼(A) to the global output in time 𝒪(1+|𝗌𝗉¯𝖾𝗇𝖼(A)|/lgM), without ever materializing it bit-by-bit. Computing a single entry takes 𝒪(1+a) time (decode A, simulate a transitions, and build D). Since |𝗌𝗉¯𝖾𝗇𝖼(A)|lgM implies a=𝒪(M) by ˜6.6, the total for all qM entries is 𝒪(qM2).

  2. 2.

    Short runs of input zeros. For each state s, we also build a table that stores, for y[0..M1/4], the value Ls[y] obtained by looking up Ls on the lgM-bit word that starts with the sparse encoding of the zero-run token 𝗌𝗉¯𝖾𝗇𝖼(0y). This allows us to advance through y consecutive input zeros in one constant-time lookup. The key point is that, for yM1/4, the token 𝗌𝗉¯𝖾𝗇𝖼(0y) has length <lgM, so it fits into one lookup word together with padding. If the tables Ls are given, then the tables Ls can be easily constructed in 𝒪(qM) time.

  3. 3.

    Long stretches where input/output are both zero. Finally, for handling very long zero-run tokens, we build the directed graph on states in which there is an edge ss iff the transducer transitions from s to s on input 0 and outputs 0. This is a pseudoforest (outdegree 1), so we can preprocess it with a simple adaptation of level ancestor queries [5] such that we can “jump” in 𝒪(1) time through long chains of transitions that keep outputting zero. Computing the graph and auxiliary data structure takes 𝒪(q) time.

Running the transducer on 𝘀𝗽¯𝗲𝗻𝗰(𝑺).

Let X:=𝗌𝗉¯𝖾𝗇𝖼(S). As an invariant, we maintain: offsets x[0..|X|] and n[0..|S|] such that X[0..x)=𝗌𝗉¯𝖾𝗇𝖼(S[0..n)), the current state s reached by the transducer after processing S[0..n), and an output representation consisting of (i) a counter z that indicates the number of trailing zeros of T[0..n) and (ii) the sparse encoding Y=𝗌𝗉¯𝖾𝗇𝖼(T[0..nz)). Here, Y is always a prefix of 𝗌𝗉¯𝖾𝗇𝖼(T) due to ˜6.7. We process the remaining suffix X[x..] in macro-steps:

  • If Ls[X[x..x+lgM)] returns b>0, then we have a whole sparse encoding X[x..x+b)=𝗌𝗉¯𝖾𝗇𝖼(A) fitting in lgM bits. We take the precomputed entry (b,a,s,z1,z2,D) and update (x,n,s) by (x+b,n+a,s). If the corresponding output A is all-zero, we just increase z. Otherwise we first flush the pending zeros by appending 𝗌𝗉¯𝖾𝗇𝖼(0z+z1) (if needed), then append the middle part via D, and finally set zz2. Near the end of X, we pad the lgM-bit window with an incomplete token to prevent decoding beyond |X|.

  • Otherwise b=0, i.e., the next token of X[x..] is long (more than lgM bits). We decode this token (and its bit length b) using Lemma 6.8. If it is a literal, we decode the symbol, evaluate one transducer transition (cost 𝒪(1+lg(1+x)/lgN) by assumption), and append the encoded output symbol using Lemma 6.8. If, however, the decoded token is a zero-run token 𝗌𝗉¯𝖾𝗇𝖼(0y), then we handle it in a series of micro-steps. We alternate between (a) fixed micro-steps that advance by M=min(y,M1/4) using Ls[M] (so we can also handle prefixes whose output is not all-zero), and (b) flexible micro-steps that use the precomputed graph and auxiliary data structure to skip a maximal prefix of transitions that read 0 and output 0 (advancing n and increasing z). This continues until all y input zeros are consumed. Finally, regardless of whether the decoded token is a literal or a zero-run token, we advance x by b bits.

Once we have processed the entire X, we append 𝗌𝗉¯𝖾𝗇𝖼(0z) to Y, obtaining 𝗌𝗉¯𝖾𝗇𝖼(T).

Correctness.

By construction, each lookup-table entry faithfully simulates the transducer on the decoded prefix it represents, so using the tables updates the current state exactly as in the real run and produces exactly the corresponding output substring. The maintained invariant ensures that after every step, the processed part of X corresponds to the processed prefix of the plain input, and Y represents the output written so far up to the buffered trailing zeros. The only subtlety is concatenating outputs while preserving a valid sparse encoding; this is precisely why we keep trailing zeros in a counter z and only flush them when the next chunk produces a non-zero output, using the prefix characterization in ˜6.7.

Time bound.

Each macro-step with b>0 advances the input encoding by a maximal sparse-encoding prefix inside a lgM-bit window; hence, any two consecutive macro-steps advance the input encoding by more than lgM bits (as otherwise, the steps could have been merged), and there are 𝒪(|𝗌𝗉¯𝖾𝗇𝖼(S)|/lgM) macro-steps.

Micro-steps only occur inside long zero-run tokens. Every flexible micro-step advances the output to the next non-zero symbol. Therefore, for four consecutive micro-steps of the form (flexible, fixed, flexible, fixed), the first output symbol produced by each of the two fixed steps is a non-zero symbol. Hence, the encoding of the output produced by the central two steps is a substring of the encoding appended to Y during the four steps. Also, by the definition of a fixed step, the (plain text) output corresponding to this substring is of length at least M1/4. By ˜6.6, its sparse encoding contains Ω(lgM) bits, so (ignoring 𝒪(1) initial/final micro-steps per macro-step) we get 𝒪(|𝗌𝗉¯𝖾𝗇𝖼(T)|/lgM) micro-steps overall. The number of initial/final micro-steps is limited by the number 𝒪(|𝗌𝗉¯𝖾𝗇𝖼(S)|/lgM) of macro-steps.

Finally, whenever a step takes more than constant time, it is because, for some value r, we (i) use Lemma 6.9(ii) to obtain an encoding consisting of r bits and append it to the output, (ii) use Lemmas 6.8 and 6.8 to decode (resp. encode) a token consisting of r bits and advance the input (resp. output) by r bits, or (iii) evaluate a transition on a large literal whose encoding consists of r bits. Each such cost is 𝒪(1+r/lgM), and it can be charged to the Θ(r) bits advanced in X or appended to Y, yielding total overhead 𝒪((|𝗌𝗉¯𝖾𝗇𝖼(S)|+|𝗌𝗉¯𝖾𝗇𝖼(T)|)/lgM). This gives total time 𝒪(1+(|𝗌𝗉¯𝖾𝗇𝖼(S)|+|𝗌𝗉¯𝖾𝗇𝖼(T)|)/lgM)=𝒪(1+(|𝗌𝗉¯𝖾𝗇𝖼(S)|+|𝗌𝗉¯𝖾𝗇𝖼(T)|)/lgN).

To handle multi-stream transducers, we use a reduction of multi-stream transducers to single-stream ones. For this purpose, we define a zipped string.

Definition 6.12.

Let A1,,At with t1 be strings in 0n. The string zip(A1,,At) of length n has, for each i[0..n), its i-th symbol defined by zip(A1,,At)[i]=0 if j[1..t]Aj[i]=0, and zip(A1,,At)[i]=𝗌𝗉¯𝖾𝗇𝖼(A1[i]A2[i]At[i]) otherwise.

We stress that this zipped string is not, in itself, a sparse encoding – it is a string in which each non-zero symbol is the sparsely encoded concatenation of the corresponding symbols of the original strings. Crucially, when sparsely encoding the zipped sequence, there is only a constant factor overhead over the sparsely encoded original strings.

Lemma 6.13.

Given a constant number of equal-length strings A1,,At0n, it holds |𝗌𝗉¯𝖾𝗇𝖼(zip(A1,,At))|=𝒪(j=1t|𝗌𝗉¯𝖾𝗇𝖼(Aj)|).

Given the sparse encodings of the input strings, we first produce the sparse encoding of their zipped string. For the result below, we use similar techniques as in the proof of Theorem 6.11, processing up to Ω(lgN) bits of the input encodings in constant time by exploiting precomputed information. Unlike in the proof of Theorem 6.11, a long synchronized run of zeros in the input strings always leads to a run of zeros in the output, simplifying the algorithm to some extent. However, non-synchronized runs of zeros pose an additional challenge, as described in detail in the full version.

Theorem 6.14.

For every N[2..2w], after an 𝒪(N)-time preprocessing, the following holds. If A1,,At[0..σ)n with t=𝒪(1) and n,σ2𝒪(w), then 𝗌𝗉¯𝖾𝗇𝖼(zip(A1,,At)) can be computed from 𝗌𝗉¯𝖾𝗇𝖼(A1),,𝗌𝗉¯𝖾𝗇𝖼(At) in 𝒪(1+j=1t|𝗌𝗉¯𝖾𝗇𝖼(Aj)|/lgN) time.

Finally, there is an obvious reduction from a transducer with t input strings to a single-stream transducer that receives the zipped version of the t input strings. By applying Theorem 6.11 to this single-stream transducer, we obtain the following result.

Corollary 6.15.

Consider a transducer over alphabet [0..σ) with states [0..q), where σ,q2𝒪(w), and t=𝒪(1) input streams. If the transition function can be evaluated in 𝒪(1) time, then, for any N[2..2w], after an 𝒪(qN)-time preprocessing, the following holds.

Let S1,,St be input strings of common length n2𝒪(w) for which the transducer produces output T. Then 𝗌𝗉¯𝖾𝗇𝖼(T) can be computed from 𝗌𝗉¯𝖾𝗇𝖼(S1),,𝗌𝗉¯𝖾𝗇𝖼(St) in 𝒪((|𝗌𝗉¯𝖾𝗇𝖼(T)|+i=1t|𝗌𝗉¯𝖾𝗇𝖼(Si)|)/lgN) time.

6.2 Faster Synchronizing Set Queries

Using Corollary 6.15, we obtain sparsely encoded versions of the sets Bk, of 𝖱𝖴𝖭𝖲τ,τ/3(T) and 𝖱𝖴𝖭𝖲2τ,τ/3(T), and finally of a τ-synchronizing set. Ultimately, we derive the following.

Theorem 6.16.

A string T[0..σ)n can be preprocessed in 𝒪(n/logσn) time so that, given τ[1..n/2], a τ-synchronizing set 𝖲𝗒𝗇𝖼 of T of size |𝖲𝗒𝗇𝖼|<70nτ can be constructed in 𝒪(nlgττlgn) time and 𝒪(nlgττ) bits of space. The set is reported as 𝗌𝗉¯𝖾𝗇𝖼(M) for M{0,1}n such that M[i]=1i𝖲𝗒𝗇𝖼. Moreover, 𝗉𝖾𝗋(T[i..i+2τ))>13τ holds for every i𝖲𝗒𝗇𝖼.

6.3 Adding Rank and Select Support

Theorem 6.16 returns the synchronizing set in sparse encoding, which by itself does not allow fast random access. Hence, we develop support data structures that augment the encoding for fast rank and select queries. For any set S and x0, we define rankS(x)=|{ySy<x}| and predS(x)=max({ySyx}{}). For every i[1..|S|], we define selectS(i)=max{ySrankS(y)<i}. For S[0..U) and its characteristic bitmask A[0..U), we may equivalently use subscript A rather than S.

We can use a precomputed lookup table to greedily parse any encoding into pieces of size around lgN bits, and then use another table to answer rank and select queries with respect to any piece in constant time. This is formalized below.

Lemma 6.17.

For every N[5..2w] and every bitmask A[0..n), there is a sequence (i,pi,ei,ri)i=0h with h=𝒪(|𝗌𝗉¯𝖾𝗇𝖼(A)|/lgN) satisfying the following properties. The entries are defined by p0=e0=0, ph=n, eh=|𝗌𝗉¯𝖾𝗇𝖼(A)|, and, for i[0..h),

  • 𝗌𝗉¯𝖾𝗇𝖼(A)[ei..ei+1)=𝗌𝗉¯𝖾𝗇𝖼(A[pi..pi+1)) and ri=rankA(pi), and

  • either A[pi..pi+1) is all-zero, or ri+1riei+1eilgN.

After a 𝒪~(N) time preprocessing, the following holds. Given 𝗌𝗉¯𝖾𝗇𝖼(A), the sequence can be computed in 𝒪(|𝗌𝗉¯𝖾𝗇𝖼(A)|/lgN) time and 𝒪(|𝗌𝗉¯𝖾𝗇𝖼(A)|lgn/lgN) bits of space. In the same time and space, we can compute a data structure that,

  • given i[0..h] and j[pi..pi+1), returns rankA(j) in constant time, and

  • given i[0..h] and j(ri..ri+1], returns selectA(j) in constant time.

Now, to answer a query selectA(j), we only have to find the unique tuple of the decomposition with ri<jri+1. This can be done via two auxiliary bitmasks of length |𝗌𝗉¯𝖾𝗇𝖼(A)| that respectively mark the starting positions of literal tokens in 𝗌𝗉¯𝖾𝗇𝖼(A) and the positions ei of all the tuples. Then, we can find the correct tuples via rank and select queries on the auxiliary bitmasks. Crucially, we can use existing data structures for constant time rank and select support on these bitmasks [4].

Lemma 6.18.

For every N[5..2w], after a 𝒪~(N) time preprocessing, the following holds. Given a sparse encoding 𝗌𝗉¯𝖾𝗇𝖼(A) of a bitmask A[0..n) with n2𝒪(w) and |𝗌𝗉¯𝖾𝗇𝖼(A)|=𝒪(poly(N)), we can compute a data structure for 𝒪(1) time select queries in 𝒪(|𝗌𝗉¯𝖾𝗇𝖼(A)|/lgN) time and 𝒪(|𝗌𝗉¯𝖾𝗇𝖼(A)|(1+lgn/lgN)) bits of space.

For implementing rank support, we rely on an improved version of van Emde Boas trees [42] given in the Theorem below. It is well known that the claimed complexities can be achieved with expected construction time and space [33, 34]. Our deterministic solution can be obtained by essentially replacing the hash tables of van Emde Boas trees with deterministic dictionaries [37]. For completeness, we give a detailed description in the full version.

Theorem 1.3. [Restated, see original statement.]

Let S[0..2) of size |S|=n with 2 and n,22𝒪(w) be given as an array of -bit integers in increasing order. For mn, let a=lg(m/n)+lgw. A deterministic data structure that answers rank and predecessor queries in 𝒪(lglgma) time can be built in 𝒪(m) time and words of space.

We construct this data structure for the sequence p0,,ph from Lemma 6.17, simulating words of width w=Θ(lgn). This way, for a query rankA(j), we can find the unique i such that j[pi..pi+1), allowing us to answer the query with Lemma 6.17.

Lemma 6.19.

For every N[5..2w], after a 𝒪~(N) time preprocessing, the following holds. Given a sparse encoding 𝗌𝗉¯𝖾𝗇𝖼(A) of a bitmask A[0..n) with n2𝒪(w) and a parameter m|𝗌𝗉¯𝖾𝗇𝖼(A)|/lgN, we can compute a data structure for 𝒪(lglgnlgmlglgn) time rank and predecessor queries in 𝒪(m) time and 𝒪(mlgn) bits of space.

Finally, by combining Theorem 6.16 with Lemma 6.18 and Lemma 6.19 with parameter m=Θ(nlgττlgn), we obtain the following main result.

Corollary 6.20.

A string T[0..σ)n can be preprocessed in 𝒪(n/logσn) time so that, given τ[1..n/2], a τ-synchronizing set 𝖲𝗒𝗇𝖼 of T of size |𝖲𝗒𝗇𝖼|<70nτ can be constructed in 𝒪(nlgττlgn) time. The set is reported in a representation of size 𝒪(nlgττ) bits that supports select queries in constant time, and rank queries in 𝒪(lglgτlglgn) time.

References

  • [1] Shyan Akmal and Ce Jin. Near-optimal quantum algorithms for string problems. Algorithmica, 85(8):2260–2317, 2023. doi:10.1007/S00453-022-01092-X.
  • [2] Mai Alzamel, Maxime Crochemore, Costas S. Iliopoulos, Tomasz Kociumaka, Jakub Radoszewski, Wojciech Rytter, Juliusz Straszynski, Tomasz Waleń, and Wiktor Zuba. Quasi-linear-time algorithm for longest common circular factor. In Nadia Pisanti and Solon P. Pissis, editors, 30th Annual Symposium on Combinatorial Pattern Matching, CPM 2019, June 18-20, 2019, Pisa, Italy, volume 128 of LIPIcs, pages 25:1–25:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.CPM.2019.25.
  • [3] Lorraine A. K. Ayad, Grigorios Loukides, and Solon P. Pissis. Text indexing for long patterns using locally consistent anchors. VLDB J., 34(5):58, 2025. doi:10.1007/S00778-025-00935-7.
  • [4] Maxim A. Babenko, Paweł Gawrychowski, Tomasz Kociumaka, and Tatiana Starikovskaya. Wavelet trees meet suffix trees. In Piotr Indyk, editor, Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 572–591. SIAM, 2015. doi:10.1137/1.9781611973730.39.
  • [5] Michael A. Bender and Martin Farach-Colton. The level ancestor problem simplified. Theor. Comput. Sci., 321(1):5–12, 2004. doi:10.1016/J.TCS.2003.05.002.
  • [6] Or Birenzwige, Shay Golan, and Ely Porat. Locally consistent parsing for text indexing in small space. In Shuchi Chawla, editor, Proceedings of the 2020 ACM-SIAM Symposium on Discrete Algorithms, SODA 2020, Salt Lake City, UT, USA, January 5-8, 2020, pages 607–626. SIAM, 2020. doi:10.1137/1.9781611975994.37.
  • [7] Christina Boucher, Travis Gagie, Alan Kuhnle, Ben Langmead, Giovanni Manzini, and Taher Mun. Prefix-free parsing for building big BWTs. Algorithms Mol. Biol., 14(1):13:1–13:15, 2019. doi:10.1186/S13015-019-0148-5.
  • [8] Panagiotis Charalampopoulos, Tomasz Kociumaka, Solon P. Pissis, and Jakub Radoszewski. Faster algorithms for longest common substring. In Petra Mutzel, Rasmus Pagh, and Grzegorz Herman, editors, 29th Annual European Symposium on Algorithms, ESA 2021, September 6-8, 2021, Lisbon, Portugal (Virtual Conference), volume 204 of LIPIcs, pages 30:1–30:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.ESA.2021.30.
  • [9] Panagiotis Charalampopoulos, Manal Mohamed, Jakub Radoszewski, Wojciech Rytter, Tomasz Waleń, and Wiktor Zuba. Counting distinct square substrings in sublinear time. In Paweł Gawrychowski, Filip Mazowiecki, and Michal Skrzypczak, editors, 50th International Symposium on Mathematical Foundations of Computer Science, MFCS 2025, August 25-29, 2025, Warsaw, Poland, volume 345 of LIPIcs, pages 36:1–36:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPIcs.MFCS.2025.36.
  • [10] Panagiotis Charalampopoulos, Solon P. Pissis, and Jakub Radoszewski. Longest palindromic substring in sublinear time. In Hideo Bannai and Jan Holub, editors, 33rd Annual Symposium on Combinatorial Pattern Matching, CPM 2022, June 27-29, 2022, Prague, Czech Republic, volume 223 of LIPIcs, pages 20:1–20:9. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPIcs.CPM.2022.20.
  • [11] Graham Cormode and S. Muthukrishnan. Substring compression problems. In Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2005, Vancouver, British Columbia, Canada, January 23-25, 2005, pages 321–330. SIAM, 2005. URL: http://dl.acm.org/citation.cfm?id=1070432.1070478.
  • [12] Graham Cormode and S. Muthukrishnan. The string edit distance matching problem with moves. ACM Trans. Algorithms, 3(1):2:1–2:19, 2007. doi:10.1145/1219944.1219947.
  • [13] Patrick Dinklage, Johannes Fischer, Alexander Herlez, Tomasz Kociumaka, and Florian Kurpicz. Practical performance of space efficient data structures for longest common extensions. In Fabrizio Grandoni, Grzegorz Herman, and Peter Sanders, editors, 28th Annual European Symposium on Algorithms, ESA 2020, September 7-9, 2020, Pisa, Italy (Virtual Conference), volume 173 of LIPIcs, pages 39:1–39:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.ESA.2020.39.
  • [14] Peter Elias. Universal codeword sets and representations of the integers. IEEE Trans. Inf. Theory, 21(2):194–203, 1975. doi:10.1109/TIT.1975.1055349.
  • [15] Jonas Ellert. Sublinear time Lempel-Ziv (LZ77) factorization. In Franco Maria Nardini, Nadia Pisanti, and Rossano Venturini, editors, String Processing and Information Retrieval - 30th International Symposium, SPIRE 2023, Pisa, Italy, September 26-28, 2023, Proceedings, volume 14240 of Lecture Notes in Computer Science, pages 171–187. Springer, 2023. doi:10.1007/978-3-031-43980-3_14.
  • [16] N. J. Fine and H. S. Wilf. Uniqueness theorems for periodic functions. Proceedings of the American Mathematical Society, 16:109–114, 1965. doi:10.1090/S0002-9939-1965-0174934-9.
  • [17] Ragnar Groot Koerkamp. Optimal Throughput Bioinformatics. PhD thesis, ETH Zurich, 2025. doi:10.3929/ethz-c-000783091.
  • [18] Torben Hagerup. Sorting and searching on the word RAM. In Michel Morvan, Christoph Meinel, and Daniel Krob, editors, STACS 98, 15th Annual Symposium on Theoretical Aspects of Computer Science, Paris, France, February 25-27, 1998, Proceedings, volume 1373 of Lecture Notes in Computer Science, pages 366–398. Springer, 1998. doi:10.1007/BFB0028575.
  • [19] Artur Jeż. Approximation of grammar-based compression via recompression. Theor. Comput. Sci., 592:115–134, 2015. doi:10.1016/J.TCS.2015.05.027.
  • [20] Artur Jeż. Recompression: A simple and powerful technique for word equations. J. ACM, 63(1):4:1–4:51, 2016. doi:10.1145/2743014.
  • [21] Ce Jin and Jakob Nogler. Quantum speed-ups for string synchronizing sets, longest common substring, and k-mismatch matching. ACM Trans. Algorithms, 20(4):32:1–32:36, 2024. doi:10.1145/3672395.
  • [22] Dominik Kempa and Tomasz Kociumaka. String synchronizing sets: sublinear-time BWT construction and optimal LCE data structure. In Moses Charikar and Edith Cohen, editors, Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, STOC 2019, Phoenix, AZ, USA, June 23-26, 2019, pages 756–767. ACM, 2019. doi:10.1145/3313276.3316368.
  • [23] Dominik Kempa and Tomasz Kociumaka. Dynamic suffix array with polylogarithmic queries and updates. In Stefano Leonardi and Anupam Gupta, editors, STOC ’22: 54th Annual ACM SIGACT Symposium on Theory of Computing, Rome, Italy, June 20 - 24, 2022, pages 1657–1670. ACM, 2022. doi:10.1145/3519935.3520061.
  • [24] Dominik Kempa and Tomasz Kociumaka. Resolution of the Burrows-Wheeler transform conjecture. Commun. ACM, 65(6):91–98, 2022. doi:10.1145/3531445.
  • [25] Dominik Kempa and Tomasz Kociumaka. Breaking the O(n)-barrier in the construction of compressed suffix arrays and suffix trees. In Nikhil Bansal and Viswanath Nagarajan, editors, Proceedings of the 2023 ACM-SIAM Symposium on Discrete Algorithms, SODA 2023, Florence, Italy, January 22-25, 2023, pages 5122–5202. SIAM, 2023. doi:10.1137/1.9781611977554.CH187.
  • [26] Dominik Kempa and Tomasz Kociumaka. Lempel-Ziv (LZ77) factorization in sublinear time. In 65th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2024, Chicago, IL, USA, October 27-30, 2024, pages 2045–2055. IEEE, 2024. doi:10.1109/FOCS61266.2024.00122.
  • [27] Tomasz Kociumaka, Jakub Radoszewski, Wojciech Rytter, and Tomasz Waleń. Internal pattern matching queries in a text and applications. In Piotr Indyk, editor, Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, CA, USA, January 4-6, 2015, pages 532–551. SIAM, 2015. doi:10.1137/1.9781611973730.36.
  • [28] Tomasz Kociumaka, Jakub Radoszewski, Wojciech Rytter, and Tomasz Waleń. Internal pattern matching queries in a text and applications. SIAM J. Comput., 53(5):1524–1577, 2024. doi:10.1137/23M1567618.
  • [29] Roman M. Kolpakov and Gregory Kucherov. Finding maximal repetitions in a word in linear time. In 40th Annual Symposium on Foundations of Computer Science, FOCS 1999, New York, NY, USA, October 17-18, 1999, pages 596–604. IEEE Computer Society, 1999. doi:10.1109/SFFCS.1999.814634.
  • [30] Grigorios Loukides and Solon P. Pissis. Bidirectional string anchors: A new string sampling mechanism. In Petra Mutzel, Rasmus Pagh, and Grzegorz Herman, editors, 29th Annual European Symposium on Algorithms, ESA 2021, September 6-8, 2021, Lisbon, Portugal (Virtual Conference), volume 204 of LIPIcs, pages 64:1–64:21. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.ESA.2021.64.
  • [31] Mamoru Maekawa. A square root N algorithm for mutual exclusion in decentralized systems. ACM Trans. Comput. Syst., 3(2):145–159, 1985. doi:10.1145/214438.214445.
  • [32] Kurt Mehlhorn, R. Sundar, and Christian Uhrig. Maintaining dynamic sequences under equality tests in polylogarithmic time. Algorithmica, 17(2):183–198, 1997. doi:10.1007/BF02522825.
  • [33] Mihai Pătraşcu and Mikkel Thorup. Time-space trade-offs for predecessor search. In Jon M. Kleinberg, editor, Proceedings of the 38th Annual ACM Symposium on Theory of Computing, Seattle, WA, USA, May 21-23, 2006, pages 232–240. ACM, 2006. doi:10.1145/1132516.1132551.
  • [34] Mihai Pătraşcu and Mikkel Thorup. Time-space trade-offs for predecessor search, 2006. doi:10.48550/arXiv.cs/0603043.
  • [35] Jakub Radoszewski and Wiktor Zuba. Computing string covers in sublinear time. In Zsuzsanna Lipták, Edleno Silva de Moura, Karina Figueroa, and Ricardo Baeza-Yates, editors, String Processing and Information Retrieval - 31st International Symposium, SPIRE 2024, Puerto Vallarta, Mexico, September 23-25, 2024, Proceedings, volume 14899 of Lecture Notes in Computer Science, pages 272–288. Springer, 2024. doi:10.1007/978-3-031-72200-4_21.
  • [36] Michael Roberts, Wayne Hayes, Brian R. Hunt, Stephen M. Mount, and James A. Yorke. Reducing storage requirements for biological sequence comparison. Bioinformatics, 20(18):3363–3369, 2004. doi:10.1093/bioinformatics/bth408.
  • [37] Milan Ruzic. Constructing efficient dictionaries in close to sorting time. In Luca Aceto, Ivan Damgård, Leslie Ann Goldberg, Magnús M. Halldórsson, Anna Ingólfsdóttir, and Igor Walukiewicz, editors, Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part I: Track A: Algorithms, Automata, Complexity, and Games, volume 5125 of Lecture Notes in Computer Science, pages 84–95. Springer, 2008. doi:10.1007/978-3-540-70575-8_8.
  • [38] Süleyman Cenk Sahinalp and Uzi Vishkin. On a parallel-algorithms method for string matching problems. In Maurizio A. Bonuccelli, Pierluigi Crescenzi, and Rossella Petreschi, editors, Algorithms and Complexity, Second Italian Conference, CIAC ’94, Rome, Italy, February 23-25, 1994, Proceedings, volume 778 of Lecture Notes in Computer Science, pages 22–32. Springer, 1994. doi:10.1007/3-540-57811-0_3.
  • [39] Süleyman Cenk Sahinalp and Uzi Vishkin. Symmetry breaking for suffix tree construction. In Frank Thomson Leighton and Michael T. Goodrich, editors, Proceedings of the Twenty-Sixth Annual ACM Symposium on Theory of Computing, 23-25 May 1994, Montréal, Québec, Canada, pages 300–309. ACM, 1994. doi:10.1145/195058.195164.
  • [40] Süleyman Cenk Sahinalp and Uzi Vishkin. Efficient approximate and dynamic matching of patterns using a labeling paradigm (extended abstract). In 37th Annual Symposium on Foundations of Computer Science, FOCS 1996, Burlington, Vermont, USA, 14-16 October, 1996, pages 320–328. IEEE Computer Society, 1996. doi:10.1109/SFCS.1996.548491.
  • [41] Saul Schleimer, Daniel Shawcross Wilkerson, and Alex Aiken. Winnowing: Local algorithms for document fingerprinting. In Alon Y. Halevy, Zachary G. Ives, and AnHai Doan, editors, Proceedings of the 2003 ACM SIGMOD International Conference on Management of Data, San Diego, California, USA, June 9-12, 2003, pages 76–85. ACM, 2003. doi:10.1145/872757.872770.
  • [42] Peter van Emde Boas. Preserving order in a forest in less than logarithmic time. In 16th Annual Symposium on Foundations of Computer Science, Berkeley, California, USA, October 13-15, 1975, pages 75–84. IEEE Computer Society, 1975. doi:10.1109/SFCS.1975.26.