Skip to main content

A Simple Fast Hybrid Pattern-Matching Algorithm

  • Conference paper
Combinatorial Pattern Matching (CPM 2005)

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

Included in the following conference series:

Abstract

The Knuth-Morris-Pratt (KMP) pattern-matching algorithm guarantees both independence from alphabet size and worst-case execution time linear in the pattern length; on the other hand, the Boyer-Moore (BM) algorithm provides near-optimal average-case and best-case behaviour, as well as executing very fast in practice. We describe a simple algorithm that employs the main ideas of KMP and BM (with a little help from Sunday) in an effort to combine these desirable features. Experiments indicate that in practice the new algorithm is among the fastest exact pattern-matching algorithms discovered to date, perhaps dominant for alphabet size 8 or more.

Supported in part by grants from the Natural Sciences & Engineering Research Council of Canada.

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. Boyer, R.S., Moore, J.S.: A fast string searching algorithm. Commun. Assoc. Comput. Mach. 20(10), 762–772 (1977)

    Google Scholar 

  2. Charras, C., Lecroq, T.: Exact String Matching Algorithms, Laboratoire d’Informatique, Université de Rouen (1997), http://www-igm.univ-mlv.fr/~lecroq/string/index.html

  3. Cole, R., Hariharan, R.: Tighter bounds on the exact complexity of string matching. In: Proc. 33rd IEEE Symp. Found. Comp. Sci., pp. 600–609 (1992)

    Google Scholar 

  4. Cole, R., Hariharan, R., Paterson, M.S., Zwick, U.: Tighter lower bounds on the exact complexity of string matching. SIAM J. Comput. 24(1), 30–45 (1995)

    Article  MATH  MathSciNet  Google Scholar 

  5. Colussi, L.: Correctness and efficiency of pattern matching algorithms. Information & Computation 95, 225–251 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  6. Colussi, L.: Fastest pattern matching in strings. J. Algs. 16(2), 163–189 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  7. Colussi, L., Galil, Z., Giancarlo, R.: On the exact complexity of string matching. In: Proc. 31st IEEE Symp. Found. Comp. Sci., vol. I, pp. 135–143 (1990)

    Google Scholar 

  8. Crochemore, M., Czumaj, A., Ga̧sieniec, L., Jarominek, S., Lecroq, T., Plandowski, W., Rytter, W.: Speeding up two stringmatching algorithms. Algorithmica 12, 247–267 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  9. Crochemore, M., Hancart, C., Lecroq, T.: Algorithmique du Texte, Vuibert, Paris (2001)

    Google Scholar 

  10. Galil, Z., Giancarlo, R.: On the exact complexity of string matching: lower bounds. SIAM J. Comput. 20(6), 1008–1020 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  11. Galil, Z., Giancarlo, R.: On the exact complexity of string matching: upper bounds. SIAM J. Comput. 21(3), 407–437 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  12. Hart, M.: Project Gutenberg, Project Gutenberg Literary Archive Foundation (2004), http://www.gutenberg.net

  13. Nigel Horspool, R.: Practical fast searching in strings. Software – Practice & Experience 10(6), 501–506 (1980)

    Article  Google Scholar 

  14. Hume, A., Sunday, D.: Fast string searching. Software – Practice & Experience 21(11), 1221–1248 (1991)

    Article  Google Scholar 

  15. Jennings, C.G.: A Linear-Time Algorithm for Fast Exact Pattern Matching in Strings. M. Sc. thesis, McMaster University, p. 97 (2002)

    Google Scholar 

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

    Article  MATH  MathSciNet  Google Scholar 

  17. Lecroq, T.: Experimental results on string matching algorithms. Software – Practice & Experience 25(7), 727–765 (1995)

    Article  Google Scholar 

  18. Lecroq, T.: New Experimental Results on Exact String-Matching, Rapport LIFAR 2000.03, Université de Rouen (2000)

    Google Scholar 

  19. Morris, J.H., Pratt, V.R.: A Linear Pattern-Matching Algorithm. Tech. Rep. 40, University of California, Berkeley (1970)

    Google Scholar 

  20. Smyth, B.: Computing Patterns in Strings, p. 423. Pearson Addison-Wesley, London (2003)

    Google Scholar 

  21. Sunday, D.M.: A very fast substring search algorithm. Commun. Assoc. Comput. Mach. 33(8), 132–142 (1990)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Franek, F., Jennings, C.G., Smyth, W.F. (2005). A Simple Fast Hybrid Pattern-Matching Algorithm. In: Apostolico, A., Crochemore, M., Park, K. (eds) Combinatorial Pattern Matching. CPM 2005. Lecture Notes in Computer Science, vol 3537. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11496656_25

Download citation

  • DOI: https://doi.org/10.1007/11496656_25

  • Publisher Name: Springer, Berlin, Heidelberg

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

  • Online ISBN: 978-3-540-31562-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics