摘要

Squares are strings of the form win where in is any nonempty string. Main and Lorentz proposed an O(n log n)-time algorithm for finding the positions of all squares ill a string of length n. Based on their result, we show how to find the positions of all squares in a run-length encoded string in time O(N logN) where N is the number of runs in this string, provided that we do not explicitly compute at all "trivial squares" occurring within runs. The algorithm is optimal and its time complexity is independent of the length of the original uncompressed string.

  • 出版日期2009-9-6