Sciweavers

CPM
2005
Springer

An Optimal Algorithm for Online Square Detection

14 years 5 months ago
An Optimal Algorithm for Online Square Detection
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.
Gen-Huey Chen, Jin-Ju Hong, Hsueh-I Lu
Added 26 Jun 2010
Updated 26 Jun 2010
Type Conference
Year 2005
Where CPM
Authors Gen-Huey Chen, Jin-Ju Hong, Hsueh-I Lu
Comments (0)