码迷,mamicode.com
首页 > 编程语言 > 详细

字符串匹配算法

时间:2015-04-30 12:08:00      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:

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++ == \0)            
             return (char *)NULL;     
    return (char *)s; 
}

 

2.KMP算法

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

3.PM算法

字符串匹配算法

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!