Validating the knuth-morris-pratt failure function, fast and online

  • Authors:
  • Paweł Gawrychowski;Artur Jeż;Łukasz Jeż

  • Affiliations:
  • Institute of Computer Science, University of Wrocław;Institute of Computer Science, University of Wrocław;Institute of Computer Science, University of Wrocław

  • Venue:
  • CSR'10 Proceedings of the 5th international conference on Computer Science: theory and Applications
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Let π′w denote the failure function of the Knuth-Morris-Pratt algorithm for a word w. In this paper we study the following problem: given an integer array A′[1 .. n], is there a word w over an arbitrary alphabet Σ such that A′[i]=π′w[i] for all i? Moreover, what is the minimum cardinality of Σ required? We give an elementary and self-contained $\mathcal{O}(n\log n)$ time algorithm for this problem, thus improving the previously known solution [8] with no polynomial time bound. Using both deeper combinatorial insight into the structure of π′ and more advanced tools, we further improve the running time to $\mathcal{O}(n)$.