Small Space Encoding and Recognition of $k$-Palindromic Prefixes
Abstract
Palindromes are non-empty strings that read the same forward and backward. The problem of recognizing strings that can be represented as the concatenation of even-length palindromes, the concatenation of palindromes of length at least two, and the concatenation of exactly palindromes was introduced in the seminal paper of Knuth, Morris, and Pratt [SIAM J. Comput., 1977]. In this work, we study the problem of recognizing so-called -palindromic strings, which can be represented as the concatenation of exactly palindromes. We show the following results: 1. First, we show a structural characterization of the set of all -palindromic prefixes of a string by representing it as a union of a small number of highly structured string sets, called affine prefix sets. Representing the lengths of the -palindromic prefixes in this way requires space. By constructing a lower bound, we show that the space complexity is optimal up to polylogarithmic factors for reasonably small values of . 2. Secondly, we derive a read-only algorithm that, given a string of length and an integer , computes a compact representation of -palindromic prefixes of , for all . The algorithm uses time and space. 3. Finally, we also give a read-only algorithm for computing the palindromic length of , which is the smallest such that is -palindromic. Here, we achieve time and space. For some values of , this is the first algorithm for palindromic length that uses additional working space on top of the input.
Keywords
Cite
@article{arxiv.2410.03309,
title = {Small Space Encoding and Recognition of $k$-Palindromic Prefixes},
author = {Gabriel Bathie and Jonas Ellert and Tatiana Starikovskaya},
journal= {arXiv preprint arXiv:2410.03309},
year = {2025}
}