Outline and Reading: Strings ( 9.1.1) Pattern Matching Algorithms
Outline and Reading: Strings ( 9.1.1) Pattern Matching Algorithms
a p a t t e r n m a t c h i n g a l g o r i t h m
The last-occurrence function can be represented by an array
1 3 5 11 10 9 8 7 indexed by the numeric codes of the characters
r i t h m r i t h m r i t h m r i t h m The last-occurrence function can be computed in time O(m + s),
where m is the size of P and s is the size of Σ
2 4 6
r i t h m r i t h m r i t h m
1
Pattern Matching 5/29/2002 11:27 AM
1+l
Pattern Matching 7 Pattern Matching 8
2
Pattern Matching 5/29/2002 11:27 AM