Initial Pattern Matching Algorithm

  1. read the text and the pattern

  2. position <- 1

  3. repeat until position is too large

  4.      if pattern occurs at position in text then

  5.          write position

  6.          position <- position + 1

  7. stop

Here we have used a very high level pseudocode to outline our first pass at an algorithm.

Many details have purposefully been omitted.

The flexibility and power of expressing algorithms in pseudocode is emphasized.


Pattern Matching Algorithm Demonstration

Pattern to Find:

in the string:


CS1104 Main Page
Last Updated 2001/09/13
© L.Heath, 2000, substantially updated by J.A.N. Lee, 2001.