字符串匹配算法

1.前缀蛮力匹配算法(linux内核string.h)

char* strstr(const char *s, const char *wanted) 
{    
    const size_t len = strlen(wanted);     
    if (len == 0) return (char *)s;     
    while (*s != *wanted || strncmp(s, wanted, len))        
        if (*s++ == '')            
             return (char *)NULL;     
    return (char *)s; 
}

2.KMP算法

  关于什么是KMP算法:字符串匹配的KMP算法

3.PM算法

原文地址:https://www.cnblogs.com/457220157-FTD/p/4468511.html