A square is the concatenation of two identical non-empty strings. Let S be the input string which is given character by character. Let m be the (unknown) smallest integer such that the m-th prefix of S contains a square. The online square detection problem is to determine m as soon as the m-th character of S is read. The best previously known algorithm of the online square detection problem, due to Leung, Peng, and Ting, runs in O(m log2 m) time. We improve the time complexity to O(m log β), where β is the number of distinct characters in the m-th prefix of the input string. It is not difficult to implement our algorithm to run in expected O(m) time. © Springer-Verlag Berlin Heidelberg 2005.
CITATION STYLE
Chen, G. H., Hong, J. J., & Lu, H. I. (2005). An optimal algorithm for online square detection. In Lecture Notes in Computer Science (Vol. 3537, pp. 280–287). Springer Verlag. https://doi.org/10.1007/11496656_24
Mendeley helps you to discover research relevant for your work.