 
Summary: 10
Two Dimensional Matching
String matching is a basic theoretical problem in computer science, but has
been useful in implementating various text editing tasks. The explosion
of multimedia requires an appropriate generalization of string matching
to higher dimensions. The first natural generalization is that of seeking
the occurrences of a pattern in a text where both pattern and text are
rectangles.
The last few years saw a tremendous activity in two dimensional pattern
matching algorithms. We naturally had to limit the amount of information
that entered this chapter. We chose to concentrate on serial deterministic
algorithms for some of the basic issues of two dimensional matching.
Throughout this chapter we define our problems in terms of squares
rather than rectangles, however, all results presented easily generalize to
rectangles.
10.1 Exact Matching
The Exact Two Dimensional Matching Problem is defined as follows:
INPUT: Text array T [n \Theta n] and pattern array P [m \Theta m].
OUTPUT: All locations [i; j] in T where there is an occurrence of P , i.e.
T [i + k; j + l] = P [k + 1; l + 1] 0 Ÿ k; l Ÿ n \Gamma 1.
