English

Online Square Detection

Data Structures and Algorithms 2014-11-10 v1

Abstract

The online square detection problem is to detect the first occurrence of a square in a string whose characters are provided as input one at a time. Recall that a square is a string that is a concatenation of two identical strings. In this paper we present an algorithm solving this problem in O(nlogσ)O(n\log\sigma) time and linear space on ordered alphabet, where σ\sigma is the number of different letters in the input string. Our solution is relatively simple and does not require much memory unlike the previously known online algorithm with the same working time. Also we present an algorithm working in O(nlogn)O(n\log n) time and linear space on unordered alphabet, though this solution does not outperform the previously known result with the same time bound.

Keywords

Cite

@article{arxiv.1411.2022,
  title  = {Online Square Detection},
  author = {Dmitry Kosolobov},
  journal= {arXiv preprint arXiv:1411.2022},
  year   = {2014}
}

Comments

9 pages, 4 figures

R2 v1 2026-06-22T06:51:45.218Z