Optimal Square Detection Over General Alphabets - Université de Rennes Accéder directement au contenu
Communication Dans Un Congrès Année : 2023

Optimal Square Detection Over General Alphabets

Résumé

Squares (fragments of the form xx, for some string x) are arguably the most natural type of repetition in strings. The basic algorithmic question concerning squares is to check if a given string of length n is squarefree, that is, does not contain a fragment of such form. Main and Lorentz [J. Algorithms 1984] designed an O(n log n) time algorithm for this problem, and proved a matching lower bound assuming the so-called general alphabet, meaning that the algorithm is only allowed to check if two characters are equal. As an open question, they asked if there is a faster algorithm if one restricts the size of the alphabet. Crochemore [Theor. Comput. Sci. 1986] designed a linear-time algorithm for constant-size alphabets, and combined with the more recent results his approach in fact implies such an algorithm for linearly-sortable alphabets. Very recently, Ellert and Fischer [ICALP 2021] significantly relaxed this assumption by designing a linear-time algorithm for general ordered alphabets, that is, assuming a linear order on the characters. However, the open question of Main and Lorentz from 1984 remained unresolved for general (unordered) alphabets. In this paper, we show that testing square-freeness of a length-n string over general alphabet of size σ can be done with O(n log σ) comparisons, and cannot be done with o(n log σ) comparisons. We complement this result with an O(n log σ) time algorithm in the Word RAM model.
Fichier principal
Vignette du fichier
squares.pdf (553.77 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-03991054 , version 1 (16-02-2023)

Identifiants

Citer

Jonas Ellert, Paweł Gawrychowski, Garance Gourdel. Optimal Square Detection Over General Alphabets. SODA - 2023 Annual ACM-SIAM Symposium on Discrete Algorithms, Jan 2023, Florence, Italy. pp.5220-5242, ⟨10.1137/1.9781611977554.ch189⟩. ⟨hal-03991054⟩
18 Consultations
39 Téléchargements

Altmetric

Partager

Gmail Facebook X LinkedIn More