Shortest Unique Substring (SUS): Theory and Algorithms
- Shortest unique substring (SUS) is a uniquely occurring minimal-length substring covering a given position or interval in a string.
- It builds upon the concepts of minimal unique substrings (MUS) and left-bounded SUS (LSUS) to underpin efficient, optimal query algorithms.
- SUS formulations—including point, interval, and global variants—enable output-sensitive, space-efficient indexing and dynamic maintenance in various computational models.
In string algorithms, a shortest unique substring (SUS) is a unique substring that is minimum-length subject to a query constraint, usually the requirement to cover a position or interval. For a string and interval , a substring is a SUS for if it occurs exactly once in , , and every shorter substring containing is repeating. The literature also studies a global variant that asks for any globally shortest substring that occurs exactly once in the entire string. Across these formulations, SUS is tightly connected to minimal unique substrings (MUSs), which underlie many optimal query algorithms, succinct indexes, and dynamic maintenance results (Mieno et al., 2016, Charalampopoulos et al., 6 May 2026).
1. Definitions and problem formulations
The standard query version is interval-based. A substring of a string is a shortest unique substring for interval if 0 occurs exactly once in 1, its occurrence contains 2, and every substring of 3 that contains 4 and is shorter than 5 occurs at least twice. When 6, the problem is the point SUS problem; when 7, it is the interval SUS problem (Mieno et al., 2016).
A common single-position formulation fixes a location 8 and asks for a shortest substring 9 such that 0 and 1 is unique in the entire string. In this model, an SUS always exists because the whole string is unique if needed, and a location can have multiple SUSes. For example, in 2, location 3 has two SUSes: 4 and 5 (Ileri et al., 2013).
The same term is also used for a global optimization problem: find any shortest substring 6 of 7 with 8. This version is distinct from query-dependent SUS, because it does not impose a position or interval coverage constraint (Charalampopoulos et al., 6 May 2026).
These formulations share the same uniqueness primitive but differ in objective. Query SUS minimizes length among substrings that cover a prescribed query range, whereas global SUS minimizes length over the entire string without a coverage condition. This distinction is central in comparing older suffix-array-based query algorithms with recent packed-word-RAM algorithms for the global problem (Ileri et al., 2013, Charalampopoulos et al., 6 May 2026).
2. MUS, LSUS, and the structural basis of SUS
A substring 9 of a string 0 is a minimal unique substring (MUS) if 1 and every proper substring of 2 occurs at least twice in 3. Equivalently, if 4, then 5 is a MUS iff 6 is unique, 7 is repeating, and 8 is repeating (Mieno et al., 2019).
MUS and SUS are related but not identical. A MUS is minimal by substring inclusion, whereas a SUS is shortest by length under a query constraint. In particular, not every SUS is necessarily a MUS in the strongest general sense of “the shortest unique substring returned by a SUS query.” The role of MUS is structural: MUSs are heavily utilized for solving the SUS problem, and shortest unique substrings are typically found among MUSs or derived from MUS-related structure (Mieno et al., 2019).
This relationship is sharpened by the fact that every SUS contains exactly one MUS, and no MUS is nested in another MUS. The non-nesting property yields 9, which is a recurring combinatorial invariant in both succinct encodings and output bounds (Mieno et al., 2019).
A second foundational object is the left-bounded shortest unique substring (LSUS). For each position 0, 1 is the shortest unique substring that starts exactly at 2. Using the suffix array 3, inverse suffix array 4, and LCP array, one defines
5
and then
6
This gives a direct suffix-array characterization of shortest unique prefixes of suffixes (Ileri et al., 2013).
The key structural lemma for point SUS is that every 7 is either an 8 or a right extension of an 9. Moreover, if 0 is obtained by extension, then 1 ends exactly at position 2 and 3. This recurrence is the basis of left-to-right optimal algorithms (Ileri et al., 2013).
3. Exact algorithms for reporting SUS answers
The central exact result for point SUS is an optimal 4-time, 5-space algorithm that computes an SUS for every location of a string of length 6, substantially improving the earlier 7 method. The same framework also reports all SUSes covering each location, not just one representative (Ileri et al., 2013).
The algorithm separates the problem into two layers. First, it computes all LSUSes from suffix-array primitives. Second, it maintains 8, the shortest LSUS covering location 9, while sweeping from left to right. The maintained state is a linked list of chunks, each storing 0, 1, 2, and 3. A monotonicity property over candidate lengths allows chunk merges, and the total merging cost is 4, yielding amortized 5 update time per position (Ileri et al., 2013).
Once 6 is known, 7 is chosen between 8 and the one-character extension of 9, taking the shorter candidate and breaking ties by the leftmost one. This gives a linear-time scan after linear preprocessing of suffix-array and LCP information (Ileri et al., 2013).
The same paper gives an output-sensitive extension for enumerating all SUSes covering a position. After the leftmost SUS for 0 is known, all LSUS-derived candidates of equal minimum length can be reported, together with the one-character extension of 1 when it ties. The extra cost is proportional to the number of outputs (Ileri et al., 2013).
A different exact line of work emphasizes memory minimization. An in-place framework computes SUS for every position using two integer arrays 2 and 3 of length 4 in addition to the input string. It organizes the computation into three stages: compute all 5, derive the rightmost shortest LSUS covering each position 6, and then obtain the final 7. For the exact case 8, this yields 9 total time with 0 memory words plus 1 bytes (Hon et al., 2015).
4. Combinatorial structure and multiplicity of SUS answers
The combinatorics of SUS are unusually rigid. For point queries, let 2 be the set of intervals in 3 that correspond to point SUSs over all query positions. Then
4
and this bound is tight: for any odd 5, there exists a string 6 of length 7 such that
8
Thus the maximum number of distinct point-SUS intervals is strictly less than 9 and cannot be improved asymptotically (Mieno et al., 2016).
The proof combines two inequalities involving the number of MUSs: 0 Combining them yields the tight 1 upper bound. The argument exploits the decomposition of point SUSs into three disjoint sets: SUSs that are themselves MUSs, SUSs obtained by extending a MUS to the left, and SUSs obtained by extending a MUS to the right (Mieno et al., 2016).
An important local consequence is that a position can have at most two point SUSs, and when there are two they have a rigid shape. Specifically, if 2, then there exist 3 such that
4
One answer is of the form “extend left from a MUS boundary to 5,” and the other is of the form “extend right from 6 to a MUS boundary” (Mieno et al., 2016).
For interval queries, the set 7 of non-trivial interval SUSs satisfies
8
and for any 9, there exists a string 00 of length 01 with
02
Hence the number of non-trivial interval SUSs is asymptotically below 03, and this upper bound is nearly tight (Mieno et al., 2016).
These results correct a frequent misconception that SUS answers are either unique or structurally unconstrained. The theory shows the opposite: multiplicity is possible, but tightly bounded and strongly organized by MUS boundaries (Mieno et al., 2016).
5. Succinct indexes, sliding windows, and packed-string algorithms
Space-efficient indexing has led to 04-bit data structures for both interval and point SUS queries. For interval queries, a structure of size
05
answers an interval SUS query in output-sensitive 06 time, where 07. For point queries, a smaller structure of size
08
answers a point SUS query in the same output-sensitive time. These structures rely on compact representations of MUS boundaries, notably bit vectors 09 and 10, together with rank/select support and succinct RMQ machinery (Mieno et al., 2019).
The same work gives space-efficient algorithms for computing MUSs. For each position 11, defining
12
one obtains that 13 is the longest repeating substring starting at 14, and 15 is the shortest unique substring starting at 16, unless it reaches the end of the text. MUS boundaries can therefore be found by scanning the text while accessing 17 and 18 (Mieno et al., 2019).
Dynamic and streaming settings are most naturally handled at the MUS level. In a sliding window 19, the set of MUSs changes by only 20 substrings per slide. More precisely,
21
and
22
with symmetric bounds for deleting the leftmost character; both bounds are tight for 23. This yields an 24-time and 25-space algorithm for maintaining all MUSs in a sliding window of width 26. The algorithm maintains a suffix tree for the current window together with three active loci: the primary active point 27 for 28, the secondary active point 29 for 30, and the tertiary active point 31 for the longest suffix occurring at least three times (Mieno et al., 2019).
This MUS maintenance result is directly relevant to SUS because MUSs are the structural atoms behind shortest unique substrings. A plausible implication is that dynamic SUS computation in a sliding-window setting can inherit the same locality of updates (Mieno et al., 2019).
At the opposite end of the model spectrum, recent work revisits the global SUS problem in the packed word RAM model. While folklore suffix-tree solutions run in 32 time, packed inputs over alphabet 33 can be read in 34 time, so linear time is not necessarily optimal. An algorithm running in
35
computes a global shortest unique substring by decomposing the problem according to substring length and period, and combining synchronizing sets, runs, wavelet trees, heavy-light decomposition, and a 2D skyline geometry reduction (Charalampopoulos et al., 6 May 2026).
6. Variants, analogues, and terminology
Approximate SUS introduces mismatches into the uniqueness predicate. For a string 36, a substring is 37-mismatch unique if there is no other substring of the same length starting elsewhere whose Hamming distance is at most 38. The 39-mismatch SUS covering position 40, denoted 41, is then the shortest 42-mismatch unique substring containing 43. Using the same three-stage in-place framework as in the exact case, all exact SUSes for every position are computed in 44 time, and all approximate 45-mismatch SUSes in 46 time, regardless of 47, while using 48 memory words plus 49 bytes (Hon et al., 2015).
A closely related but distinct problem is the shortest unique palindromic substring (SUPS). Here the substring must be both unique and palindromic. After 50-time and 51-space preprocessing, all SUPSs for an interval query 52 can be answered in 53 time, where 54 is the number of outputs (Nakashima et al., 2016). Later work sharpened this structure by proving that the number of SUPSs for any query interval is at most 55, and that this upper bound is tight, while also giving the first 56-bits data structures answering any interval or point SUPS query in 57 time (Mieno et al., 2022). SUPS is not ordinary SUS with a trivial extra predicate: the palindrome constraint changes the candidate structure fundamentally.
The literature also contains a terminological divergence in which “SUS” means smallest unique substring rather than shortest unique substring. In the “SUS-anchor” sampling scheme, a window 58 selects the start position of the smallest unique suffix under a character-based order, especially the anti-lexicographic order that minimizes the first character and maximizes the remaining characters. This notion is explicitly distinguished from classical shortest-unique-substring problems. The resulting anchors are forward for any character-based order, can be computed in 59 time and 60 space for window length 61, and for alphabet size 62 and 63 the anti-lexicographic SUS-anchor is empirically within 64 of the density lower bound (Koerkamp et al., 31 May 2026).
Taken together, these variants show that SUS is less a single problem than a family of uniqueness-minimization problems. The classical point and interval formulations remain centered on MUS/LSUS structure, suffix-array or suffix-tree primitives, and output-sensitive reporting; approximate, palindromic, dynamic, and packed-model variants preserve this core while altering the admissible substring class, the update model, or the computational model (Ileri et al., 2013, Hon et al., 2015, Mieno et al., 2022).