Faster Algorithms for Shortest Unique or Absent Substrings

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Charalampopoulos, Panagiotis, Mohamed, Manal, Pissis, Solon P., Verbeek, Hilde, Zuba, Wiktor
Format: Preprint
Veröffentlicht: 2026
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866910194452135936
author Charalampopoulos, Panagiotis
Mohamed, Manal
Pissis, Solon P.
Verbeek, Hilde
Zuba, Wiktor
author_facet Charalampopoulos, Panagiotis
Mohamed, Manal
Pissis, Solon P.
Verbeek, Hilde
Zuba, Wiktor
contents We revisit two well-known algorithmic problems on strings: computing a shortest unique substring (SUS) and a shortest absent substring (SAS) of a string $S$ of length $n$. Both problems admit folklore $\mathcal{O}(n)$-time solutions using the suffix tree of $S$. However, for small alphabets, this complexity is not necessarily optimal in the word RAM model, where a string of length $n$ over alphabet $[0,σ)$ can be stored in $\mathcal{O}(n \log σ/\log n)$ space and read in $\mathcal{O}(n \log σ/\log n)$ time. We present an $\mathcal{O}(n \log σ/\sqrt{\log n})$-time algorithm for computing a SUS of $S$. 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 $\mathcal{O}(n \log σ/\sqrt{\log n})$-time algorithm for computing a SAS of $S$.
format Preprint
id arxiv_https___arxiv_org_abs_2605_04826
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Faster Algorithms for Shortest Unique or Absent Substrings
Charalampopoulos, Panagiotis
Mohamed, Manal
Pissis, Solon P.
Verbeek, Hilde
Zuba, Wiktor
Data Structures and Algorithms
We revisit two well-known algorithmic problems on strings: computing a shortest unique substring (SUS) and a shortest absent substring (SAS) of a string $S$ of length $n$. Both problems admit folklore $\mathcal{O}(n)$-time solutions using the suffix tree of $S$. However, for small alphabets, this complexity is not necessarily optimal in the word RAM model, where a string of length $n$ over alphabet $[0,σ)$ can be stored in $\mathcal{O}(n \log σ/\log n)$ space and read in $\mathcal{O}(n \log σ/\log n)$ time. We present an $\mathcal{O}(n \log σ/\sqrt{\log n})$-time algorithm for computing a SUS of $S$. 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 $\mathcal{O}(n \log σ/\sqrt{\log n})$-time algorithm for computing a SAS of $S$.
title Faster Algorithms for Shortest Unique or Absent Substrings
topic Data Structures and Algorithms
url https://arxiv.org/abs/2605.04826