The Simple Algorithm

The Simple Algorithm

i:=1; j:=1; k:=1;

While j £ T.length And k £ P.length Do

If t[j] = p[k] Then

j := j + 1; k := k + 1;

Else

i := i + 1; j := i; k := 1;

End If

End While;

If k > P.length Then

Return True;

Else

Return False;

Endif

Previous slide Next slide Back to the first slide View Graphic Version