String KMP matching algorithm

zhaozj2021-02-16  52

I. Tsinghua Yin Kun Data Structure Notes (C Edition, PPT Format): 1. Failure Function F (J) F (J) = Max {K | 0 <= K 0, the target pointer does not change, the mode pointer returns to p [f (j-1) 1].

Second. Use the C language to describe the algorithm for the algorithm (Tsinghua's Yan Weimin), Liu Yu data structure: 1.Next [J] Next [J] = 0 J = 1 max {K | 1

Summary 1. First exclude the confusion of the starting date of 0 and 1. The starting date is 0: f (j) = max {k | 0 <= k

Next [j] = -1 j = 0 max {k | 0

Position

1

2

3

4

5

6

Seduce

8

Value

a

b

a

a

b

c

a

c

Next [j]

0

1

1

2

2

3

1

2

f (j)

0

0

1

1

2

0

1

0

转载请注明原文地址:https://www.9cbs.com/read-19129.html

New Post(0)