Weak Repititions in Strings

L. J. Cummings 1, W. F. Smyth2,3
1 Faculty of Mathematics University of Waterloo Waterloo, Ontario, Canada N2L 3G1
2Department of Computer Science & Systems McMaster University Hamilton, Ontario, Canada L85 418
3 School of Computing Curtin University of Technology

Abstract

A weak repetition in a string consists of two or more adjacent substrings which are permutations of each other. We describe a straightforward \(\Theta(n^2)\) algorithm which computes all the weak repetitions in a given string of length \(n\) defined
on an arbitrary alphabet \(A\). Using results on Fibonacci and other simple strings, we prove that this algorithm is asymptotically optimal over all known encodings of the output.