KMP模式匹配算法
来源:互联网 发布:ubuntu 环境变量 编辑:程序博客网 时间:2024/05/10 06:03
#include <stdio.h>#include<stdlib.h>#include <ctype.h>typedef unsigned char u8;void get_next(u8 *T,int *next){int i,j;i = 1;j = 0;next[1] = 0;while( i < T[0]){if( j == 0 || T[i] == T[j]){i++;j++;next[i] = j;}else j = next[j];}}int Index_KMP( u8 *S, u8 *T, int pos){int i = pos;int j = 1;int next[255];get_next( T, next);while( i <= S[0] && j <= T[0]){if( j == 0 || S[i] == T[j]){i++;j++;}else{j = next[j];}}if( j > T[0]) return i - T[0]; else return 0;}int main(int argc, char *argv[]){u8 s[] = " abacdaaabcdesiosjdifiejfi";u8 t[] = " cdesios"; s[0] = sizeof(s) - 2; t[0] = sizeof(t) - 2; //for( i = 0; i < j; i++) printf("%d",Index_KMP( s, t, 1));while(1);return 0;}
0 0
- 模式匹配---KMP算法
- 模式匹配 KMP算法
- 模式匹配-KMP算法
- KMP模式匹配算法
- KMP模式匹配算法
- KMP模式匹配算法
- 模式匹配kmp算法
- 模式匹配算法kmp
- KMP模式匹配算法
- KMP模式匹配算法
- KMP模式匹配算法
- KMP模式匹配算法
- KMP模式匹配算法
- KMP模式匹配算法
- KMP模式匹配算法
- KMP模式匹配算法
- KMP算法模式匹配
- KMP 模式匹配算法
- start-all.sh JAVA_HOME is not set and could not be found
- socket编程函数详解
- scfdvgfbh
- 传统的概要设计 详细设计是不是面向过程或者是数据流的分析方法
- 如何彻底卸载MySQL
- KMP模式匹配算法
- dgghj
- redis主从配置
- 黑马程序员——基础加强之 类加载器,动态代理
- Camel路由启动过程
- java列出指定目录下的文件
- 图论结论
- 关于windows桌面网络图标显示未连接却可以上网的情况
- Shell编程基础