Advertisement

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

  • Christian Charras
  • Thierry Lecrog
  • Joseph Daniel Pehoushek
Session I
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1448)

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.

Keywords

String Match Search Phase Preprocessing Phase String Match Algorithm Symbol Comparison 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    R. S. Boyer and J. S. Moore. A fast string searching algorithm. Comm. ACM, 20(10):762–772,1977.Google Scholar
  2. [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. [3]
    M. Crochemore and W. Rytter. Text algorithms. Oxford University Press, 1994.Google Scholar
  4. [4]
    A. Hume and D. M. Sunday. Fast string searching. Software-Practice Experience, 21 (11):1221–1248, 1991.Google Scholar
  5. [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. [6]
    T. Lecroq. A variation on the Boyer-Moore algorithm. Theoret. Comput. Sci., 92(l):119–144,1992.Google Scholar
  7. [7]
    T. Lecroq. Experiments on string matching in memory structures. Software-Practice & Experience, 28(5):562–568, 1998.Google Scholar
  8. [8]
    J. H. Morris, Jr and V. R. Pratt. A linear pattern-matching algorithm. Report 40, University of California, Berkeley, 1970.Google Scholar
  9. [9]
    T. Raita. Tuning the Boyer-Moore-Horspool string searching algorithm. Software-Practice & Experience, 22(10):879–884, 1992.Google Scholar
  10. [10]
    G. A. Stephen. String searching algorithms. World Scientific Press, 1994.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1998

Authors and Affiliations

  • Christian Charras
    • 1
  • Thierry Lecrog
    • 1
  • Joseph Daniel Pehoushek
  1. 1.LIR (Laboratoire d‘Informatique de Rouen) and ABISS (Atelier Biologie Informatique Statistique et Socio-Linguistique), Faculté des Sciences et des TechniquesUniversité de RouenMont Saint-Aignan CedexFrance

Personalised recommendations