Shortest Absent Substring (SAS) Algorithms
- 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 is a string of minimum length that does not occur in as a substring. For , a string is absent iff , and 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 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 (Akagi et al., 2021).
1. Definition and formal problem statement
Let the input be a string
of length over the integer alphabet 0. A string 1 is absent from 2 iff
3
A string 4 is a shortest absent substring iff
5
The formal output specification used in the packed-word-RAM treatment is stronger than returning only the minimum length: given packed 6, the algorithm returns 7 and 8 such that
9
is a shortest absent substring of 0 (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,
1
2. Classical formulation and packed-string motivation
Classically, SAS is folklore-solvable in 2 time using the suffix tree 3. The standard idea is that if a node 4 of the suffix tree has fewer than 5 outgoing edges, then for every missing outgoing first letter 6, the string 7 is absent from 8; the shortest absent strings arise from minimum-depth nodes with a missing edge. This yields extraction of all SASs in 9 time (Charalampopoulos et al., 6 May 2026).
The packed-string model changes the cost baseline. In the unit-cost word-RAM with word size 0, a string over alphabet 1 can be packed with 2 letters per machine word. A length-3 string therefore occupies
4
machine words and can be read in
5
time (Charalampopoulos et al., 6 May 2026). For small alphabets, simply reading the packed input is already sublinear in 6. The folklore suffix-tree solution remains 7, 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
8
time in the packed-string word-RAM model (Charalampopoulos et al., 6 May 2026). The same asymptotic bound applies for integer alphabets 9 with 0. The asymptotic gain is strongest when 1 is small; the bound is asymptotically faster than 2 whenever
3
and for constant alphabets it becomes
4
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 5, find a shortest substring of 6 that does not occur in 7. The paper proves that any instance of Shortest Exclusive Substring can be solved in
8
time, and then reduces SAS to this problem by choosing 9 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:
- short substrings;
- medium-length aperiodic substrings;
- long aperiodic substrings;
- periodic substrings.
The same principal tools reappear with an exclusive interpretation. Synchronizing sets anchor sufficiently long aperiodic candidates in both 0 and 1. 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 2 and by no point of 3, minimizing 4. The key lemma states that Minimum Exclusive Point can be solved in
5
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 6 over alphabet 7 of size 8 is a string of length
9
in which every string from 0 occurs exactly once. The paper proves that a packed de Bruijn sequence of order 1 over 2 for 3 can be constructed in
4
time, and its prefix of length 5 can be constructed in
6
time (Charalampopoulos et al., 6 May 2026).
Set
7
Since 8, the string 9 cannot contain all 0 strings of length 1, so every SAS has length at most 2. The algorithm then builds a de Bruijn sequence 3 of order 4 and runs Shortest Exclusive Substring on 5. If the result has length at most 6, it is a SAS. Otherwise the SAS length is 7. At that point, either a full de Bruijn sequence of order 8 is constructed when 9, or only a prefix 0 of length 1 is constructed when 2. In the latter case, the counting argument is explicit: 3 contains
4
distinct substrings of length 5, while 6 contains at most
7
such substrings, so at least one length-8 substring of 9 is absent from 0 (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 1 of length 2 over integer alphabet 3 can be computed in
4
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 5 with
6
In the reduction through exclusivity, the exclusive substring found in the de Bruijn sequence is itself an absent string of 7, 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
8
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 9. It improves on 00 but does not reach the packed-input reading bound
01
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 02 is a minimal absent word for 03 iff 04 does not occur in 05 but 06 and 07 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 08 so that for any query range 09, one can return a shortest string over the alphabet that does not occur in 10. For a string 11 of length 12 over 13 of size 14, the paper "Internal Shortest Absent Word Queries in Constant Time and Linear Space" gives an 15-space data structure with 16 query time and 17 construction time (Badkobeh et al., 2021).
The core quantity there is the shortest absent-word length
18
where 19 is the number of distinct length-20 substrings of 21. This yields
22
The data structure returns a constant-space representation of the answer, either as a range 23 meaning 24, or as a range 25 and a letter 26, meaning 27 (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 28, these results bound the instability of shortest absent substrings indirectly. For a window of length 29, the total number of MAW changes over all adjacent windows is
30
and this bound is tight when 31. At a single shift, the worst-case symmetric difference is 32. For binary alphabets, the one-step bound tightens to
33
(Akagi et al., 2021). Earlier sliding-window work had already shown the contrast with minimal unique substrings: MUSs can change by only 34 per shift, whereas MAWs may change by 35 (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 36, the paper "Minimal Absent Words on Run-Length Encoded Strings" gives an 37-space data structure that can output all MAWs in 38 time, with build time 39. A direct consequence is that SAS can be obtained by enumerating MAWs and selecting a shortest one, yielding 40 time and 41 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
42
time using
43
space, where
44
and 45 for any string of length 46 (Inenaga et al., 2024). The paper excludes trivial length-1 absent characters from 47, so for the fully general SAS problem one must separately check whether some alphabet symbol is absent from 48; 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 49, where 50 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.