You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
374 B

4 years ago
package main
import "fmt"
/**
KMP算法中每一次的匹配
1主串的起始位置 = 上一轮匹配的失配位置
2模式串的起始位置 = 重复字符结构的下一位字符无重复字符结构则模式串的首字符
*/
func main() {
fmt.Println("KMP算法 开始...")
strA := "ababcabcacbab"
strB := "abcac"
fmt.Println(strB, strA)
}