KMP算法

基本思想 求next數組 時間複雜度:O(m+n) #include <stdio.h> #include <string.h> #include <stdlib.h> //樸素查找算法 //在主串str中查找子串sub int BF(const char *str,const char *sub,int pos)//O(n*m) { int lenstr = strlen(str); in
相關文章
相關標籤/搜索