Algorithms

Pattern matching

The Problem: Given a text (string of characters)

                    T1, T2, T3, ..., Tn

and a pattern (string of characters)

                     P1P2P3 ... Pm,

find all occurrences of the pattern in the text.

EXAMPLE.  With text

     The cat and the rat sat on the mat.

and pattern
                                at

the solution is that there are matches at these positions:

                        6, 18, 22, 33.
 
 

[Prev][TOC][Next]


CS1104 Main Page
Last Updated 01/05/2000
© L.Heath, 2000