Skip to main content

Validating the Knuth-Morris-Pratt Failure Function, Fast and Online

  • Conference paper
Computer Science – Theory and Applications (CSR 2010)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 6072))

Included in the following conference series:

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)\).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Breslauer, D., Colussi, L., Toniolo, L.: On the comparison complexity of the string prefix-matching problem. J. Algorithms 29(1), 18–67 (1998)

    Article  MATH  MathSciNet  Google Scholar 

  2. Clément, J., Crochemore, M., Rindone, G.: Reverse engineering prefix tables. In: Proceedings of 26th STACS, pp. 289–300 (2009)

    Google Scholar 

  3. Cole, R., Hariharan, R.: Dynamic lca queries on trees. In: Proceedings of SODA ’99, Philadelphia, PA, USA, pp. 235–244. Society for Industrial and Applied Mathematics (1999)

    Google Scholar 

  4. Crochemore, M., Hancart, C., Lecroq, T.: Algorithms on Strings. Cambridge University Press, Cambridge (2007)

    Book  MATH  Google Scholar 

  5. Crochemore, M., Rytter, W.: Jewels of Stringology. World Scientific Publishing Company, Singapore (2002)

    Book  Google Scholar 

  6. Dietzfelbinger, M., Karlin, A.R., Mehlhorn, K., auf der Heide, F.M., Rohnert, H., Tarjan, R.E.: Dynamic perfect hashing: Upper and lower bounds. SIAM J. Comput. 23(4), 738–761 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  7. Duval, J.-P., Lecroq, T., Lefebvre, A.: Border array on bounded alphabet. Journal of Automata, Languages and Combinatorics 10(1), 51–60 (2005)

    MATH  MathSciNet  Google Scholar 

  8. Duval, J.-P., Lecroq, T., Lefebvre, A.: Efficient validation and construction of Knuth-Morris-Pratt arrays. In: Conference in honor of Donald E. Knuth (2007)

    Google Scholar 

  9. Duval, J.-P., Lecroq, T., Lefebvre, A.: Efficient validation and construction of border arrays and validation of string matching automata. ITA 43(2), 281–297 (2009)

    MATH  MathSciNet  Google Scholar 

  10. Farach, M.: Optimal suffix tree construction with large alphabets. In: Proceedings of FOCS ’97, Washington, DC, USA, pp. 137–143. IEEE Computer Society, Los Alamitos (1997)

    Google Scholar 

  11. Franěk, F., Gao, S., Lu, W., Ryan, P.J., Smyth, W.F., Sun, Y., Yang, L.: Verifying a border array in linear time. J. Comb. Math. Comb. Comput. 42, 223–236 (2002)

    MATH  Google Scholar 

  12. Fredman, M.L., Willard, D.E.: Trans-dichotomous algorithms for minimum spanning trees and shortest paths. J. Comput. Syst. Sci. 48(3), 533–551 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  13. Hancart, C.: On Simon’s string searching algorithm. Inf. Process. Lett. 47(2), 95–99 (1993)

    Article  MATH  MathSciNet  Google Scholar 

  14. I, T., Inenaga, S., Bannai, H., Takeda, M.: Counting parameterized border arrays for a binary alphabet. In: Proc. of the 3rd LATA, pp. 422–433 (2009)

    Google Scholar 

  15. Karp, R.M., Miller, R.E., Rosenberg, A.L.: Rapid identification of repeated patterns in strings, trees and arrays. In: STOC ’72: Proceedings of the fourth annual ACM symposium on Theory of computing, pp. 125–136. ACM, New York (1972)

    Chapter  Google Scholar 

  16. Knuth, D.E., Morris Jr., J.H., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977)

    Article  MATH  MathSciNet  Google Scholar 

  17. McCreight, E.M.: A space-economical suffix tree construction algorithm. J. ACM 23(2), 262–272 (1976)

    Article  MATH  MathSciNet  Google Scholar 

  18. Moore, D., Smyth, W.F., Miller, D.: Counting distinct strings. Algorithmica 23(1), 1–13 (1999)

    Article  MATH  MathSciNet  Google Scholar 

  19. Morris Jr., J.H., Pratt, V.R.: A linear pattern-matching algorithm. Technical Report 40, University of California, Berkeley (1970)

    Google Scholar 

  20. Pagh, R., Rodler, F.F.: Cuckoo hashing. J. Algorithms 51(2), 122–144 (2004)

    Article  MATH  MathSciNet  Google Scholar 

  21. Simon, I.: String matching algorithms and automata. In: Karhumäki, J., Rozenberg, G., Maurer, H.A. (eds.) Results and Trends in Theoretical Computer Science. LNCS, vol. 812, pp. 386–395. Springer, Heidelberg (1994)

    Google Scholar 

  22. Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14(3), 249–260 (1995)

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Gawrychowski, P., Jeż, A., Jeż, Ł. (2010). Validating the Knuth-Morris-Pratt Failure Function, Fast and Online. In: Ablayev, F., Mayr, E.W. (eds) Computer Science – Theory and Applications. CSR 2010. Lecture Notes in Computer Science, vol 6072. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-13182-0_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-13182-0_13

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-13181-3

  • Online ISBN: 978-3-642-13182-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics