Papers
Topics
Authors
Recent
Search
2000 character limit reached

Shortest Unique Substring (SUS): Theory and Algorithms

Updated 5 July 2026
  • 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 SS and interval [s,t][s,t], a substring S[i..j]S[i..j] is a SUS for [s,t][s,t] if it occurs exactly once in SS, [s,t][i,j][s,t] \subseteq [i,j], and every shorter substring containing [s,t][s,t] 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 QQ of a string SS is a shortest unique substring for interval [s,t][s,t] if [s,t][s,t]0 occurs exactly once in [s,t][s,t]1, its occurrence contains [s,t][s,t]2, and every substring of [s,t][s,t]3 that contains [s,t][s,t]4 and is shorter than [s,t][s,t]5 occurs at least twice. When [s,t][s,t]6, the problem is the point SUS problem; when [s,t][s,t]7, it is the interval SUS problem (Mieno et al., 2016).

A common single-position formulation fixes a location [s,t][s,t]8 and asks for a shortest substring [s,t][s,t]9 such that S[i..j]S[i..j]0 and S[i..j]S[i..j]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 S[i..j]S[i..j]2, location S[i..j]S[i..j]3 has two SUSes: S[i..j]S[i..j]4 and S[i..j]S[i..j]5 (Ileri et al., 2013).

The same term is also used for a global optimization problem: find any shortest substring S[i..j]S[i..j]6 of S[i..j]S[i..j]7 with S[i..j]S[i..j]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 S[i..j]S[i..j]9 of a string [s,t][s,t]0 is a minimal unique substring (MUS) if [s,t][s,t]1 and every proper substring of [s,t][s,t]2 occurs at least twice in [s,t][s,t]3. Equivalently, if [s,t][s,t]4, then [s,t][s,t]5 is a MUS iff [s,t][s,t]6 is unique, [s,t][s,t]7 is repeating, and [s,t][s,t]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 [s,t][s,t]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 SS0, SS1 is the shortest unique substring that starts exactly at SS2. Using the suffix array SS3, inverse suffix array SS4, and LCP array, one defines

SS5

and then

SS6

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 SS7 is either an SS8 or a right extension of an SS9. Moreover, if [s,t][i,j][s,t] \subseteq [i,j]0 is obtained by extension, then [s,t][i,j][s,t] \subseteq [i,j]1 ends exactly at position [s,t][i,j][s,t] \subseteq [i,j]2 and [s,t][i,j][s,t] \subseteq [i,j]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 [s,t][i,j][s,t] \subseteq [i,j]4-time, [s,t][i,j][s,t] \subseteq [i,j]5-space algorithm that computes an SUS for every location of a string of length [s,t][i,j][s,t] \subseteq [i,j]6, substantially improving the earlier [s,t][i,j][s,t] \subseteq [i,j]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 [s,t][i,j][s,t] \subseteq [i,j]8, the shortest LSUS covering location [s,t][i,j][s,t] \subseteq [i,j]9, while sweeping from left to right. The maintained state is a linked list of chunks, each storing [s,t][s,t]0, [s,t][s,t]1, [s,t][s,t]2, and [s,t][s,t]3. A monotonicity property over candidate lengths allows chunk merges, and the total merging cost is [s,t][s,t]4, yielding amortized [s,t][s,t]5 update time per position (Ileri et al., 2013).

Once [s,t][s,t]6 is known, [s,t][s,t]7 is chosen between [s,t][s,t]8 and the one-character extension of [s,t][s,t]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 QQ0 is known, all LSUS-derived candidates of equal minimum length can be reported, together with the one-character extension of QQ1 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 QQ2 and QQ3 of length QQ4 in addition to the input string. It organizes the computation into three stages: compute all QQ5, derive the rightmost shortest LSUS covering each position QQ6, and then obtain the final QQ7. For the exact case QQ8, this yields QQ9 total time with SS0 memory words plus SS1 bytes (Hon et al., 2015).

4. Combinatorial structure and multiplicity of SUS answers

The combinatorics of SUS are unusually rigid. For point queries, let SS2 be the set of intervals in SS3 that correspond to point SUSs over all query positions. Then

SS4

and this bound is tight: for any odd SS5, there exists a string SS6 of length SS7 such that

SS8

Thus the maximum number of distinct point-SUS intervals is strictly less than SS9 and cannot be improved asymptotically (Mieno et al., 2016).

The proof combines two inequalities involving the number of MUSs: [s,t][s,t]0 Combining them yields the tight [s,t][s,t]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 [s,t][s,t]2, then there exist [s,t][s,t]3 such that

[s,t][s,t]4

One answer is of the form “extend left from a MUS boundary to [s,t][s,t]5,” and the other is of the form “extend right from [s,t][s,t]6 to a MUS boundary” (Mieno et al., 2016).

For interval queries, the set [s,t][s,t]7 of non-trivial interval SUSs satisfies

[s,t][s,t]8

and for any [s,t][s,t]9, there exists a string [s,t][s,t]00 of length [s,t][s,t]01 with

[s,t][s,t]02

Hence the number of non-trivial interval SUSs is asymptotically below [s,t][s,t]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 [s,t][s,t]04-bit data structures for both interval and point SUS queries. For interval queries, a structure of size

[s,t][s,t]05

answers an interval SUS query in output-sensitive [s,t][s,t]06 time, where [s,t][s,t]07. For point queries, a smaller structure of size

[s,t][s,t]08

answers a point SUS query in the same output-sensitive time. These structures rely on compact representations of MUS boundaries, notably bit vectors [s,t][s,t]09 and [s,t][s,t]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 [s,t][s,t]11, defining

[s,t][s,t]12

one obtains that [s,t][s,t]13 is the longest repeating substring starting at [s,t][s,t]14, and [s,t][s,t]15 is the shortest unique substring starting at [s,t][s,t]16, unless it reaches the end of the text. MUS boundaries can therefore be found by scanning the text while accessing [s,t][s,t]17 and [s,t][s,t]18 (Mieno et al., 2019).

Dynamic and streaming settings are most naturally handled at the MUS level. In a sliding window [s,t][s,t]19, the set of MUSs changes by only [s,t][s,t]20 substrings per slide. More precisely,

[s,t][s,t]21

and

[s,t][s,t]22

with symmetric bounds for deleting the leftmost character; both bounds are tight for [s,t][s,t]23. This yields an [s,t][s,t]24-time and [s,t][s,t]25-space algorithm for maintaining all MUSs in a sliding window of width [s,t][s,t]26. The algorithm maintains a suffix tree for the current window together with three active loci: the primary active point [s,t][s,t]27 for [s,t][s,t]28, the secondary active point [s,t][s,t]29 for [s,t][s,t]30, and the tertiary active point [s,t][s,t]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 [s,t][s,t]32 time, packed inputs over alphabet [s,t][s,t]33 can be read in [s,t][s,t]34 time, so linear time is not necessarily optimal. An algorithm running in

[s,t][s,t]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 [s,t][s,t]36, a substring is [s,t][s,t]37-mismatch unique if there is no other substring of the same length starting elsewhere whose Hamming distance is at most [s,t][s,t]38. The [s,t][s,t]39-mismatch SUS covering position [s,t][s,t]40, denoted [s,t][s,t]41, is then the shortest [s,t][s,t]42-mismatch unique substring containing [s,t][s,t]43. Using the same three-stage in-place framework as in the exact case, all exact SUSes for every position are computed in [s,t][s,t]44 time, and all approximate [s,t][s,t]45-mismatch SUSes in [s,t][s,t]46 time, regardless of [s,t][s,t]47, while using [s,t][s,t]48 memory words plus [s,t][s,t]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 [s,t][s,t]50-time and [s,t][s,t]51-space preprocessing, all SUPSs for an interval query [s,t][s,t]52 can be answered in [s,t][s,t]53 time, where [s,t][s,t]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 [s,t][s,t]55, and that this upper bound is tight, while also giving the first [s,t][s,t]56-bits data structures answering any interval or point SUPS query in [s,t][s,t]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 [s,t][s,t]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 [s,t][s,t]59 time and [s,t][s,t]60 space for window length [s,t][s,t]61, and for alphabet size [s,t][s,t]62 and [s,t][s,t]63 the anti-lexicographic SUS-anchor is empirically within [s,t][s,t]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).

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 Unique Substring (SUS).