The Max-Shift Algorithm for Approximate String Matching

  • Costas S. Iliopoulos
  • Laurent Mouchard
  • Yoan J. Pinzon
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2141)


The approximate string matching problem is to find all locations which a pattern of length m matches a substring of a text of length n with at most k differences. The program agrep is a simple and practical bit-vector algorithm for this problem. In this paper we consider the following incremental version of the problem: given an appropriate encoding of a comparison between A and bB, can one compute the answer for A and B, and the answer for A and Bc with equal efficiency, where b and c are additional symbols? Here we present an elegant and very easy to implement bit-vector algorithm for answering these questions that requires only O(n⌈m/w⌉) time, where n is the length of A, m is the length of B and w is the number of bits in a machine word. We also present an O(nm⌈h/w⌉) algorithm for the fixed-length approximate string matching problem: given a text t, a pattern p and an integer h, compute the optimal alignment of all substrings of p of length h and a substring of t.


String algorithms approximate string matching dynamic programming edit-distance 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    R. A. Baeza-Yates and G. H. Gonnet, A new approach to text searching, CACM, Vol 35, (1992), pp. 74–82.Google Scholar
  2. 2.
    R. A. Baeza-Yates and G. Navarro, A faster algorithm for approximate string matching, in Proceedings of the 7th Symposium on Combinatorial Pattern Matching, LNCS, Vol. 1075, Springer-Verlag, New York, (1996), pp. 1–23.Google Scholar
  3. 3.
    R. A. Baeza-Yates and G. Navarro, Analysis for algorithm engineering: Improving an algorithm for approximate pattern matching. Unpublished manuscript.Google Scholar
  4. 4.
    Z. Galil and K. Park, An improved algorithm for approximate string matching, SI AM Journal on Computing, 19 (1990), pp. 989–999.zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    P. A. Hall and G. R. Dowling, Approximate string matching, Computing Surveys, Vol 12, (1980), pp. 381–402.CrossRefMathSciNetGoogle Scholar
  6. 6.
    J. W. Hunt and T. G. Szymanski, An algorithm for differential file comparison, Comm. of the ACM, Vol 20, (1977), pp. 350–353.zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    G. M. Landau, E. Myers and J. P. Schmidt, Incremental string comparison, SIAM Journal on Computing 27,2 (1998), 557–582.zbMATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    G. M. Landau and U. Vishkin, Fast string matching with k differences, Journal of Computer and Systems Sciences, 37 (1988), pp. 63–78.zbMATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    M. Maes, On a cyclic string-to-string correction problem, in Info. Proc. Lett., Vol. 35, (1990), pp. 73–78.zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    W. J. Masek and M. S. Paterson, A Fast algorithm for computing string edit distances. in J. Comput. Sy. Sci., Vol. 20, (1980), pp. 18–31.zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    E. W. Myers, A Fast Bit-Vector Algorithm for Approximate String Matching Based on Dynamic Progamming, in Journal of the ACM 46,3 (1999) pp. 395–415.zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    S. B. Needleman and C. D. Wunsch, A general method applicable to the search for similarities in the amino acid sequence of the two proteins, in J. of Mol. Bio., Vol 48 (1970), pp. 443–453.CrossRefGoogle Scholar
  13. 13.
    P.H. Seller, The theory and computation of evolutionary distances: Pattern recognition, in Journal of Algorithms, Vol 1, (1980), pp. 359–373.à.CrossRefMathSciNetGoogle Scholar
  14. 14.
    T. F. Smith and M. S. Waterman, Identification of common molecular subsequences, in Journal of Molecular Biology, Vol 147, No. 2 (1981), pp. 195–197.CrossRefGoogle Scholar
  15. 15.
    E. Ukkonen, Finding approximate patterns in strings, in J. of Algorithms, Vol 6, (1985), pp. 132–137.zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    R. A. Wangner and M. J. Fischer, The string-to-string correction problem, in J. of the ACM, Vol 21, No. 1 (1974), pp. 168–173.CrossRefGoogle Scholar
  17. 17.
    A. H. Wright, Approximate string matching using within-word parallelism. in Soft. Pract. Exper., Vol 24, (1994), pp. 337–362.zbMATHCrossRefGoogle Scholar
  18. 18.
    S. Wu and U. Manber, Fast text searching allowing errors, CACM, Vol 35, (1992), pp. 83–91.Google Scholar
  19. 19.
    S. Wu, U. Manber and G. Myers, A subquadratic algorithm for approximate limited expression matching, in Algorithmica, Vol. 15, (1996), pp. 50–67.zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Costas S. Iliopoulos
    • 1
    • 2
  • Laurent Mouchard
    • 3
    • 4
  • Yoan J. Pinzon
    • 1
    • 2
  1. 1.Dept. of Computer ScienceKing’s College LondonLondonEngland
  2. 2.School of ComputingCurtin University of Technology
  3. 3.ESA 6037: Dept. of Vegetal Physiology - ABISSUniversité de Rouen76821 Mont Saint Aignan CedexFrance
  4. 4.School of ComputingCurtin University of Technology

Personalised recommendations