Papers
Topics
Authors
Recent
Search
2000 character limit reached

Shortest Absent Substring (SAS) Algorithms

Updated 5 July 2026
  • Shortest Absent Substring (SAS) is defined as the minimal-length string absent from a given sequence where every proper substring occurs.
  • The algorithm leverages a reduction to shortest exclusive substring problems and de Bruijn sequences to achieve O(n log σ/√log n) time in packed-string word-RAM models.
  • SAS is tightly connected to minimal absent words and shortest unique substrings, offering practical insights for efficient substring query and data structure design.

Searching arXiv for recent and foundational papers on shortest absent substrings and closely related minimal absent word results. A shortest absent substring (SAS) of a string SS is a string of minimum length that does not occur in SS as a substring. For S[0,σ)nS \in [0,\sigma)^n, a string PP is absent iff Occ(P,S)=0|Occ(P,S)|=0, and PP is a SAS iff it is absent and no shorter absent string exists. In the packed-string word-RAM setting, the 2026 work "Faster Algorithms for Shortest Unique or Absent Substrings" establishes that SAS can be computed in O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n}) time by reducing absence to a shortest exclusivity problem and using de Bruijn sequences as a compact witness universe (Charalampopoulos et al., 6 May 2026). Combinatorially, every SAS is a minimal absent word, and the set of SASs is exactly the minimum-length layer of MAW(S)MAW(S) (Akagi et al., 2021).

1. Definition and formal problem statement

Let the input be a string

S[0,σ)nS \in [0,\sigma)^n

of length nn over the integer alphabet SS0. A string SS1 is absent from SS2 iff

SS3

A string SS4 is a shortest absent substring iff

SS5

The formal output specification used in the packed-word-RAM treatment is stronger than returning only the minimum length: given packed SS6, the algorithm returns SS7 and SS8 such that

SS9

is a shortest absent substring of S[0,σ)nS \in [0,\sigma)^n0 (Charalampopoulos et al., 6 May 2026). Thus the witness is encoded as a substring of the input plus one appended character.

SAS is closely related to two adjacent notions. First, a shortest unique substring (SUS) is a substring occurring exactly once and having minimum length among such substrings. Second, a minimal absent word (MAW) is an absent string all of whose proper substrings occur. Every SAS is therefore a MAW, because if a proper substring of a shortest absent string were also absent, that proper substring would be a shorter absent string. Equivalently,

S[0,σ)nS \in [0,\sigma)^n1

(Akagi et al., 2021).

2. Classical formulation and packed-string motivation

Classically, SAS is folklore-solvable in S[0,σ)nS \in [0,\sigma)^n2 time using the suffix tree S[0,σ)nS \in [0,\sigma)^n3. The standard idea is that if a node S[0,σ)nS \in [0,\sigma)^n4 of the suffix tree has fewer than S[0,σ)nS \in [0,\sigma)^n5 outgoing edges, then for every missing outgoing first letter S[0,σ)nS \in [0,\sigma)^n6, the string S[0,σ)nS \in [0,\sigma)^n7 is absent from S[0,σ)nS \in [0,\sigma)^n8; the shortest absent strings arise from minimum-depth nodes with a missing edge. This yields extraction of all SASs in S[0,σ)nS \in [0,\sigma)^n9 time (Charalampopoulos et al., 6 May 2026).

The packed-string model changes the cost baseline. In the unit-cost word-RAM with word size PP0, a string over alphabet PP1 can be packed with PP2 letters per machine word. A length-PP3 string therefore occupies

PP4

machine words and can be read in

PP5

time (Charalampopoulos et al., 6 May 2026). For small alphabets, simply reading the packed input is already sublinear in PP6. The folklore suffix-tree solution remains PP7, so its running time is not necessarily input-optimal in this model.

The 2026 result answers the resulting question affirmatively: SAS can be computed in

PP8

time in the packed-string word-RAM model (Charalampopoulos et al., 6 May 2026). The same asymptotic bound applies for integer alphabets PP9 with Occ(P,S)=0|Occ(P,S)|=00. The asymptotic gain is strongest when Occ(P,S)=0|Occ(P,S)|=01 is small; the bound is asymptotically faster than Occ(P,S)=0|Occ(P,S)|=02 whenever

Occ(P,S)=0|Occ(P,S)|=03

and for constant alphabets it becomes

Occ(P,S)=0|Occ(P,S)|=04

3. Reduction to exclusivity and the de Bruijn construction

The faster SAS algorithm is not obtained by refining suffix-tree traversal. Instead, it proceeds through an auxiliary two-string problem, Shortest Exclusive Substring: given strings Occ(P,S)=0|Occ(P,S)|=05, find a shortest substring of Occ(P,S)=0|Occ(P,S)|=06 that does not occur in Occ(P,S)=0|Occ(P,S)|=07. The paper proves that any instance of Shortest Exclusive Substring can be solved in

Occ(P,S)=0|Occ(P,S)|=08

time, and then reduces SAS to this problem by choosing Occ(P,S)=0|Occ(P,S)|=09 to contain a sufficiently rich set of candidate strings (Charalampopoulos et al., 6 May 2026).

The exclusive-substring algorithm reuses the SUS framework with the same four-case decomposition:

  1. short substrings;
  2. medium-length aperiodic substrings;
  3. long aperiodic substrings;
  4. periodic substrings.

The same principal tools reappear with an exclusive interpretation. Synchronizing sets anchor sufficiently long aperiodic candidates in both PP0 and PP1. Analysis of runs groups periodic candidates by Lyndon root or sparse-Lyndon root. Wavelet trees organize prefix/suffix pair families, now with an origin bit distinguishing the two strings. Several subproblems are reduced geometrically: the SUS primitive Minimum Skyline Point is replaced by Minimum Exclusive Point, which asks for a point dominated by at least one point of PP2 and by no point of PP3, minimizing PP4. The key lemma states that Minimum Exclusive Point can be solved in

PP5

time when the point sets are given sorted by one coordinate (Charalampopoulos et al., 6 May 2026).

The SAS-specific ingredient is the use of de Bruijn sequences. A de Bruijn sequence of order PP6 over alphabet PP7 of size PP8 is a string of length

PP9

in which every string from O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})0 occurs exactly once. The paper proves that a packed de Bruijn sequence of order O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})1 over O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})2 for O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})3 can be constructed in

O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})4

time, and its prefix of length O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})5 can be constructed in

O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})6

time (Charalampopoulos et al., 6 May 2026).

Set

O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})7

Since O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})8, the string O(nlogσ/logn)\mathcal{O}(n\log \sigma/\sqrt{\log n})9 cannot contain all MAW(S)MAW(S)0 strings of length MAW(S)MAW(S)1, so every SAS has length at most MAW(S)MAW(S)2. The algorithm then builds a de Bruijn sequence MAW(S)MAW(S)3 of order MAW(S)MAW(S)4 and runs Shortest Exclusive Substring on MAW(S)MAW(S)5. If the result has length at most MAW(S)MAW(S)6, it is a SAS. Otherwise the SAS length is MAW(S)MAW(S)7. At that point, either a full de Bruijn sequence of order MAW(S)MAW(S)8 is constructed when MAW(S)MAW(S)9, or only a prefix S[0,σ)nS \in [0,\sigma)^n0 of length S[0,σ)nS \in [0,\sigma)^n1 is constructed when S[0,σ)nS \in [0,\sigma)^n2. In the latter case, the counting argument is explicit: S[0,σ)nS \in [0,\sigma)^n3 contains

S[0,σ)nS \in [0,\sigma)^n4

distinct substrings of length S[0,σ)nS \in [0,\sigma)^n5, while S[0,σ)nS \in [0,\sigma)^n6 contains at most

S[0,σ)nS \in [0,\sigma)^n7

such substrings, so at least one length-S[0,σ)nS \in [0,\sigma)^n8 substring of S[0,σ)nS \in [0,\sigma)^n9 is absent from nn0 (Charalampopoulos et al., 6 May 2026).

4. Complexity, reconstruction, and open questions

The headline theorem is that a shortest absent substring of a packed string nn1 of length nn2 over integer alphabet nn3 can be computed in

nn4

time (Charalampopoulos et al., 6 May 2026). The construction of the relevant de Bruijn sequence or prefix is lower-order at the scales used, so the Shortest Exclusive Substring calls dominate the total running time.

The algorithm is deterministic in the SAS result as presented. The output is an actual absent string, not just its length. In the direct SAS formulation this is returned as nn5 with

nn6

In the reduction through exclusivity, the exclusive substring found in the de Bruijn sequence is itself an absent string of nn7, and because the de Bruijn reference strings are generated explicitly, the witness can be reconstructed directly from the reported position and length (Charalampopoulos et al., 6 May 2026).

The paper does not state a single consolidated standalone space theorem for the full SAS algorithm. It gives component-level bounds instead; for example, the long aperiodic exclusive case states that the relevant tries occupy

nn8

space. The principal contribution is the time improvement rather than a unified space bound (Charalampopoulos et al., 6 May 2026).

Several limitations remain explicit. The result is stated in the packed word-RAM model for integer alphabets with nn9. It improves on SS00 but does not reach the packed-input reading bound

SS01

The paper also notes that proving conditional lower bounds for SUS and SAS appears challenging, and leaves open whether the new bounds can be improved further or shown conditionally optimal (Charalampopoulos et al., 6 May 2026).

5. Relation to minimal absent words and indexed query variants

The MAW viewpoint is the standard combinatorial envelope for SAS. A word SS02 is a minimal absent word for SS03 iff SS04 does not occur in SS05 but SS06 and SS07 do occur; equivalently, all proper substrings occur. This immediately implies that shortest absent substrings are precisely minimum-length MAWs (Akagi et al., 2021).

That equivalence supports stronger query models. In the internal shortest absent word problem, one preprocesses a text SS08 so that for any query range SS09, one can return a shortest string over the alphabet that does not occur in SS10. For a string SS11 of length SS12 over SS13 of size SS14, the paper "Internal Shortest Absent Word Queries in Constant Time and Linear Space" gives an SS15-space data structure with SS16 query time and SS17 construction time (Badkobeh et al., 2021).

The core quantity there is the shortest absent-word length

SS18

where SS19 is the number of distinct length-SS20 substrings of SS21. This yields

SS22

The data structure returns a constant-space representation of the answer, either as a range SS23 meaning SS24, or as a range SS25 and a letter SS26, meaning SS27 (Badkobeh et al., 2021). This representation is directly aligned with the witness format used in the packed-word-RAM SAS algorithm.

6. Sliding-window, compressed-space, and neighboring formulations

The sliding-window literature studies how the MAW set changes when a fixed-length window shifts over a larger text. Since SAS is the minimum-length layer of SS28, these results bound the instability of shortest absent substrings indirectly. For a window of length SS29, the total number of MAW changes over all adjacent windows is

SS30

and this bound is tight when SS31. At a single shift, the worst-case symmetric difference is SS32. For binary alphabets, the one-step bound tightens to

SS33

(Akagi et al., 2021). Earlier sliding-window work had already shown the contrast with minimal unique substrings: MUSs can change by only SS34 per shift, whereas MAWs may change by SS35 (Mieno et al., 2019). A plausible implication is that sliding-window SAS maintenance is structurally closer to MAW maintenance than to MUS maintenance.

Compressed representations lead to different tradeoffs. For run-length encoded strings SS36, the paper "Minimal Absent Words on Run-Length Encoded Strings" gives an SS37-space data structure that can output all MAWs in SS38 time, with build time SS39. A direct consequence is that SAS can be obtained by enumerating MAWs and selecting a shortest one, yielding SS40 time and SS41 space (Akagi et al., 2022).

For highly repetitive strings, CDAWG-based compression provides a different route. "Computing Minimal Absent Words and Extended Bispecial Factors with CDAWG Space" outputs all non-trivial MAWs in

SS42

time using

SS43

space, where

SS44

and SS45 for any string of length SS46 (Inenaga et al., 2024). The paper excludes trivial length-1 absent characters from SS47, so for the fully general SAS problem one must separately check whether some alphabet symbol is absent from SS48; otherwise the shortest MAW among the non-trivial outputs is the SAS. This separates the combinatorial core of SAS from the trivial alphabet-missing case.

A common misconception is to conflate absent substrings with absent subsequences. The 2025 paper on shortest absent subsequences proves that every shortest absent subsequence has length SS49, where SS50 is the universality index, and gives linear-preprocessing enumeration algorithms with output-linear or constant delay (Manea et al., 30 Apr 2025). Those results concern scattered subsequences rather than contiguous factors. They belong to the same missing-pattern landscape, but their arch-factorization and canonical-embedding machinery is subsequence-specific rather than a reformulation of SAS.

In this sense, SAS occupies a precise place within stringology: it is simultaneously a classical suffix-tree problem, a minimum-length layer of the MAW family, an internal substring-query target, and—under packed inputs—a problem whose optimal formulation depends on representation-sensitive complexity rather than on linear-time folklore alone.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Shortest Absent Substring (SAS).