Linear Time Reconstruction of Parameterized Strings from Parameterized Suffix and LCP Arrays for Constant-Sized Alphabets
摘要
A parameterized string (p-string) is a string that can contain two kinds of characters, static symbols and parameter characters. Parameterized pattern matching is a form of pattern matching that allows parameters to be renamed by applying a one-to-one function. The parameterized suffix array is a data structure that is useful in efficient parameterized pattern matching when accompanied by the parameterized longest common prefix (LCP) array. Reconstructing input from a given instance of a data structure is the task of determining whether the instance is valid or not, and if valid, producing a plausible set of data that it can represent. In this paper we consider parameterized suffix and LCP arrays and reconstruct a corresponding p-string that they can represent. In previous work, an algorithm can determine in \(O(n^2)\) time whether a p-string can be constructed to correspond to the input parameterized suffix and LCP arrays of size n. In this work, we develop an algorithm that accomplishes this in O(n) time for constant-sized alphabets, and \(O(n \log n)\) time for general alphabets. Furthermore, when reconstruction is possible, we demonstrate that a p-string can be reconstructed over the minimal alphabet in \(O(n^2)\) time.