Online and dynamic recognition of squarefree strings

  • Authors:
  • Jesper Jansson;Zeshan Peng

  • Affiliations:
  • Department of Computer Science, The University of Hong Kong, Hong Kong;Department of Computer Science, The University of Hong Kong, Hong Kong

  • Venue:
  • MFCS'05 Proceedings of the 30th international conference on Mathematical Foundations of Computer Science
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

The online squarefree recognition problem is to detect the first occurrence of a square in a string whose characters are provided as input one at a time. We present an efficient algorithm to solve this problem for strings over arbitrarily ordered alphabets. Its running time is O(n log n), where n is the ending position of the first square, which matches the running times of the fastest known algorithms for the analogous offline problem. We also present a very simple algorithm for a dynamic version of the problem over general alphabets in which we are initially given a squarefree string, followed by a series of updates, and the objective is to determine after each update if the resulting string contains a square and if so, report it and stop.