Dynamic Text and Static Pattern Matching

  • Amihood Amir
  • Gad M. Landau
  • Moshe Lewenstein
  • Dina Sokol
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2748)


In this paper, we address a new version of dynamic pattern matching. The dynamic text and static pattern matching problem is the problem of finding a static pattern in a text that is continuously being updated. The goal is to report all new occurrences of the pattern in the text after each text update. We present an algorithm for solving the problem, where the text update operation is changing the symbol value of a text location. Given a text of length n and a pattern of length m, our algorithm preprocesses the text in time O(nlog logm), and the pattern in time \(O(m\sqrt{log m})\). The extra space used is \(O(n + m\sqrt{log m})\). Following each text update, the algorithm deletes all prior occurrences of the pattern that no longer match, and reports all new occurrences of the pattern in the text in O(log log m) time.


Pattern Match Static Pattern Query Time Pattern Occurrence Dynamic Text 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Alstrup, S., Brodal, G.S., Rauhe, T.: Pattern matching in dynamic texts. In: Proc. of the Symposium on Discrete Algorithms, pp. 819–828 (2000)Google Scholar
  2. 2.
    Amir, A., Landau, G., Sokol, D.: Inplace run-length 2d compressed search. Theoretical Computer Science 290(3), 1361–1383 (2003)zbMATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    Buchsbaum, A., Goodrich, M., Westbrook, J.: Range searching over tree cross products. In: Proc. of European Symposium of Algorithms, pp. 120–131 (2000)Google Scholar
  4. 4.
    Cole, R., Hariharan, R.: Tighter upper bounds on the exact complexity of string matching. SIAM J. on Computing 26(3), 803–856 (1997)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Farach, M.: Optimal suffix tree construction with large alphabets. In: Proc. of the Symposium on Foundations of Computer Science, pp. 137–143 (1997)Google Scholar
  6. 6.
    Farach, M., Muthukrishnan, S.: Perfect hashing for strings: formalization and algorithms. In: Proc. of Combinatorial Pattern Matching, pp. 130–140 (1996)Google Scholar
  7. 7.
    Ferragina, P., Grossi, R.: Fast incremental text editing. In: Proc. of the Symposium on Discrete Algorithms, pp. 531–540 (1995)Google Scholar
  8. 8.
    Gabow, H.N., Bentley, J., Tarjan, R.E.: Scaling and related techniques for geometric problems. In: Proc. of the Symposium on Theory of Computing, pp. 135–143 (1984)Google Scholar
  9. 9.
    Gu, M., Farach, M., Beigel, R.: An efficient algorithm for dynamic text indexing. In: Proc. of the Symposium on Discrete Algorithms, pp. 697–704 (1994)Google Scholar
  10. 10.
    Hagerup, T., Miltersen, P.B., Pagh, R.: Deterministic dictionaries. J. of Algorithms 41, 69–85 (2000)CrossRefMathSciNetGoogle Scholar
  11. 11.
    Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. on Computing 13(2), 338–355 (1984)zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Knuth, D., Morris, J., Pratt, V.: Fast pattern matching in strings. SIAM J. on Computing 6(2), 323–350 (1977)zbMATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Landau, G.M., Vishkin, U.: Fast string matching with k differences. Journal of Computer and System Sciences 37(1), 63–78 (1988)zbMATHCrossRefMathSciNetGoogle Scholar
  14. 14.
    McCreight, E.M.: A space-economical suffix tree construction algorithm. J. of the ACM 23, 262–272 (1976)zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Sahinalp, S.C., Vishkin, U.: Efficient approximate and dynamic matching of patterns using a labeling paradigm. In: Proc. of the Symposium on Foundations of Computer Science, pp. 320–328 (1996)Google Scholar
  16. 16.
    Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14, 249–260Google Scholar
  17. 17.
    van Emde Boas, P.: An \(O(n \ {\log} \ {\log} \ n)\) on-line algorithm for the insert-extract min problem. Technical Report, Department of Computer Science, Cornell University, Number TR 74-221 (1974) Google Scholar
  18. 18.
    Weiner, P.: Linear pattern matching algorithm. In: Proc. of the Symposium on Switching and Automata Theory, pp. 1–11 (1973)Google Scholar
  19. 19.
    Willard, D.E.: Log-logarithmic worst case range queries are possible in space θ(n). Information Processing Letters 17, 81–84 (1983)zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Amihood Amir
    • 1
  • Gad M. Landau
    • 2
  • Moshe Lewenstein
    • 1
  • Dina Sokol
    • 1
  1. 1.Bar-Ilan UniversityRamat GanIsrael
  2. 2.University of HaifaHaifaIsrael

Personalised recommendations