Dynamic text and static pattern matching

Amihood Amir, Gad M. Landau, Moshe Lewenstein, Dina Sokol

Research output: Contribution to journalArticlepeer-review


In this article, 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(n log log m), and the pattern in time O(m log m). The extra space used is O(n + m 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. We note that the complexity is not proportional to the number of pattern occurrences, since all new occurrences can be reported in a succinct form.

Original languageEnglish
Article number1240242
JournalACM Transactions on Algorithms
Issue number2
StatePublished - 1 May 2007


  • Border trees
  • Dynamic text
  • Static pattern

ASJC Scopus subject areas

  • Mathematics (miscellaneous)


Dive into the research topics of 'Dynamic text and static pattern matching'. Together they form a unique fingerprint.

Cite this