Efficient pattern matching with scaling

Amihood Amir, Gad M. Landau, Uzi Vishkin

Research output: Contribution to journalArticlepeer-review


The problem of pattern matching with scaling is defined. The input for the two-dimensional version of the problem consists of an n × n "text" matrix and an m × m "pattern" matrix. We want to find all occurrences of the pattern in the text, scaled to all natural multiples. That is, for every natural number i, 1 ≤ i ≤ [ n m] we seek all occurrences of the pattern in the text, where each character of the pattern corresponds to an i × i square in the text. This problem is useful for some tasks in computer vision. Our main contribution is a linear time algorithm for the problem. We also consider situations where the text is provided in a less redundant form. For instance, suppose that a repeating character is compressed into one character, along with the number of repetitions. We show how to enhance our algorithm so that its running time may become sublinear with respect to the original redundant input representation. Our algorithms are based on a new algorithmic approach to two-dimensional string matching. Unlike existing approaches, the new approach does not work by reducing a two-dimensional problem into an one-dimensional problem.

Original languageEnglish
Pages (from-to)2-32
Number of pages31
JournalJournal of Algorithms
Issue number1
StatePublished - Mar 1992
Externally publishedYes

Bibliographical note

Funding Information:
*Partially supported by NSF Grant IRI-9013055. ‘Partially supported by NSF Grant CCR-8908286 and the New York State Science and Technology Foundation, Center for Advanced Technology in Telecommunications, Polytechnic University, Brooklyn, NY. ‘Partially supported by NSF Grant CCR-8906949.

ASJC Scopus subject areas

  • Control and Optimization
  • Computational Mathematics
  • Computational Theory and Mathematics


Dive into the research topics of 'Efficient pattern matching with scaling'. Together they form a unique fingerprint.

Cite this