×

On abelian longest common factor with and without RLE. (English) Zbl 1452.68280

Summary: We consider the abelian longest common factor problem in two scenarios: when input strings are uncompressed and are of length at most \(n\), and when the input strings are run-length encoded and their compressed representations have size at most \(m\). The alphabet size is denoted by \({\sigma}\). For the uncompressed problem, we show an \(O (n^2 / \log^{1+1/\sigma}n)\)-time and \(\mathcal{O}(n)\)-space algorithm in the case of \(\sigma = \mathcal{O}(1)\), making a non-trivial use of tabulation. For the RLE-compressed problem, we show two algorithms: one working in \(\mathcal{O}(m^2 \sigma^2 \log^3 m )\) time and \(\mathcal{O}(m (\sigma^2 +\log^2 m ))\) space, which employs line sweep, and one that works in \(\mathcal{O}(m^3)\) time and \(\mathcal{O}(m)\) space that applies in a careful way a sliding-window-based approach. The latter improves upon the previously known \(\mathcal{O}(nm^2)\)-time and \(\mathcal{O}(m^4 )\)-time algorithms that were recently developed by S. Sugimoto et al. [Lect. Notes Comput. Sci. 10765, 420–431 (2018; Zbl 1453.68230)] and the first author [Lect. Notes Comput. Sci. 10508, 208–213 (2017; Zbl 1454.68203)], respectively.

MSC:

68W32 Algorithms on strings