Skip to main content

String searching algorithms revisited

  • Conference paper
  • First Online:
Algorithms and Data Structures (WADS 1989)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 382))

Included in the following conference series:

Abstract

We present bounds for the average case of the Knuth-Morris-Pratt (KMP) algorithm and the Boyer-Moore-Horspool (BMH) algorithm for random text. Experimental results in both random and English text suggests that the bounds are tight. We also present a hybrid algorithm which combines the KMP and BMH algorithms, and which, in practice, is faster than the Boyer-Moore algorithm.

This work was also supported by an Ontario Graduate Schoolarship, and the University of Chile, Santiago, Chile.

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A.V. Aho and M. Corasick. Efficient string matching: An aid to bibliographic search. C.ACM, 18(6):333–340, June 1975.

    Article  Google Scholar 

  2. A. Apostolico and R. Giancarlo. The Boyer-Moore-Galil string searching strategies revisited. SIAM J on Computing, 15:98–105, 1986.

    Article  Google Scholar 

  3. A.V. Aho. Pattern matching in strings. In R. Book, editor, Formal Language Theory: Perspectives and Open Problems, pages 325–347. Academic Press, London, 1980.

    Google Scholar 

  4. G. Barth. An alternative for the implementation of Knuth-Morris-Pratt algorithm. Inf. Proc. Letters, 13:134–137, 1981.

    Google Scholar 

  5. G. Barth. An analytical comparison of two string searching algorithms. Inf. Proc. Letters, 18:249–256, 1984.

    Google Scholar 

  6. R. Boyer and S. Moore. A fast string searching algorithm. C.ACM, 20:762–772, 1977.

    Article  Google Scholar 

  7. R. Baeza-Yates. On the average case of string matching algorithms. Technical Report CS-87-66, Department of Computer Science, University of Waterloo, Ontario, Canada, 1987.

    Google Scholar 

  8. R. Baeza-Yates. Improved string searching. Software-Practice and Experience, 19(3):257–271, 1989.

    Google Scholar 

  9. R. Baeza-Yates and M. Regnier. Analysis of Boyer-Moore type string searching algorithms. (document in preparation), 1988.

    Google Scholar 

  10. A. Clausing. Kantorovich-type inequalities. The American Mathematical Monthly, 89:314–330, 1982.

    Google Scholar 

  11. D. Cox and H. Miller. The Theory of Stochastic Processes. Chapman and Hall, London, 1965.

    Google Scholar 

  12. B. Commentz-Walter. A string matching algorithm fast on the average. In ICALP, volume 6 of Lecture Notes in Computer Science, pages 118–132. Springer-Verlag, 1979.

    Google Scholar 

  13. G. Davies and S. Bowsher. Algorithms for pattern matching. Software — Practice and Experience, 16:575–601, 1986.

    Google Scholar 

  14. Z. Galil. On improving the worst case running time of the Boyer-Moore string matching algorithm. C.ACM, 22:505–508, 1979.

    Google Scholar 

  15. L. Guibas and A. Odlyzko. A new proof of the linearity of the Boyer-Moore string searching algorithm. SIAM J on Computing, 9:672–682, 1980.

    Google Scholar 

  16. N. Horspool. Practical fast searching in strings. Software — Practice and Experience, 10:501–506, 1980.

    Google Scholar 

  17. D.E. Knuth, J. Morris, and V. Pratt. Fast pattern matching in strings. SIAM J on Computing, 6:323–350, 1977.

    Google Scholar 

  18. B. Kernighan and D. Ritchie. The C Programming Language. Prentice-Hall, Englewood Cliffs, NJ, 1978.

    Google Scholar 

  19. M. Regnier. Knuth-Morris-Pratt algorithm: An analysis. INRIA, Rocquencourt, France (unpublished), 1988.

    Google Scholar 

  20. R. Rivest. On the worst-case behavior of string-searching algorithms. SIAM J on Computing, 6:669–674, 1977.

    Google Scholar 

  21. W. Rytter. A correct preprocessing algorithm for Boyer-Moore string-searching. SIAM J on Computing, 9:509–512, 1980.

    Google Scholar 

  22. R. Schaback. On the expected sublinearity of the Boyer-Moore algorithm. SIAM J on Computing, 17:548–658, 1988.

    Google Scholar 

  23. R. Sedgewick. Algorithms. Addison-Wesley, Reading, Mass., 1983.

    Google Scholar 

  24. G.V. Smit. A comparison of three string matching algorithms. Software — Practice and Experience, 12:57–66, 1982.

    Google Scholar 

  25. T. Takaoka. An on-line pattern matching algorithm. Inf. Proc. Letters, 22:329–330, 1986.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

F. Dehne J. -R. Sack N. Santoro

Rights and permissions

Reprints and permissions

Copyright information

© 1989 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Baeza-Yates, R.A. (1989). String searching algorithms revisited. In: Dehne, F., Sack, J.R., Santoro, N. (eds) Algorithms and Data Structures. WADS 1989. Lecture Notes in Computer Science, vol 382. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-51542-9_9

Download citation

  • DOI: https://doi.org/10.1007/3-540-51542-9_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-51542-5

  • Online ISBN: 978-3-540-48237-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics