Skip to main content

A very fast string matching algorithm for small alphabets and long patterns

  • Session I
  • Conference paper
  • First Online:
Combinatorial Pattern Matching (CPM 1998)

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

Included in the following conference series:

Abstract

We are interested in the exact string matching problem which consists of searching for all the occurrences of a pattern of length m in a text of length n. Both the pattern and the text are built over an alphabet Σ of size σ. We present three versions of an exact string matching algorithm. They use a new shifting technique. The first version is straightforward and easy to implement. The second version is linear in the worst case, an improvement over the first. The main result is the third algorithm. It is very fast in practice for small alphabet and long patterns. Asymptotically, it performs O(logσ m(m + n/(m - logσ, m))) inspections of text symbols in the average case. This compares favorably with many other string searching algorithms.

The work of these authors was partially supported by the project “Informatique et Génomes” of the french CNRS.

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

    Google Scholar 

  2. M. Crochemore, A. Czumaj, L. Gćasieniec, S. Jarominek, T. Lecroq, W. Plandowski, and W. Rytter. Speeding up two string matching algorithms. Algorithmica, 12(4/5):247–267, 1994.

    Google Scholar 

  3. M. Crochemore and W. Rytter. Text algorithms. Oxford University Press, 1994.

    Google Scholar 

  4. A. Hume and D. M. Sunday. Fast string searching. Software-Practice Experience, 21 (11):1221–1248, 1991.

    Google Scholar 

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

    Google Scholar 

  6. T. Lecroq. A variation on the Boyer-Moore algorithm. Theoret. Comput. Sci., 92(l):119–144,1992.

    Google Scholar 

  7. T. Lecroq. Experiments on string matching in memory structures. Software-Practice & Experience, 28(5):562–568, 1998.

    Google Scholar 

  8. J. H. Morris, Jr and V. R. Pratt. A linear pattern-matching algorithm. Report 40, University of California, Berkeley, 1970.

    Google Scholar 

  9. T. Raita. Tuning the Boyer-Moore-Horspool string searching algorithm. Software-Practice & Experience, 22(10):879–884, 1992.

    Google Scholar 

  10. G. A. Stephen. String searching algorithms. World Scientific Press, 1994.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Martin Farach-Colton

Rights and permissions

Reprints and permissions

Copyright information

© 1998 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Charras, C., Lecrog, T., Pehoushek, J.D. (1998). A very fast string matching algorithm for small alphabets and long patterns. In: Farach-Colton, M. (eds) Combinatorial Pattern Matching. CPM 1998. Lecture Notes in Computer Science, vol 1448. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0030780

Download citation

  • DOI: https://doi.org/10.1007/BFb0030780

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-64739-3

  • Online ISBN: 978-3-540-69054-2

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics