paper

Faster Algorithms for Shortest Unique or Absent Substrings

arXiv:2605.04826

Abstract

We revisit two well-known algorithmic problems on strings: computing a shortest unique substring (SUS) and a shortest absent substring (SAS) of a string of length . Both problems admit folklore -time solutions using the suffix tree of . However, for small alphabets, this complexity is not necessarily optimal in the word RAM model, where a string of length over alphabet can be stored in space and read in time. We present an -time algorithm for computing a SUS of . This algorithm decomposes the problem according to the length and the period of the sought substring and uses several tools and techniques, such as synchronizing sets, the analysis of runs, and wavelet trees, to reduce the computation of a SUS to a simple geometric problem. Further, we adapt this algorithm and combine it with an efficient construction of de Bruijn sequences in order to obtain an -time algorithm for computing a SAS of .

SWAT 2026

Faster Algorithms for Shortest Unique or Absent Substrings · wovepaper