摘要: 嘿嘿,以前写的,刚刚突然看到的,就贴一下咯,KMP 的求next[]数组的活用,求最长重复字串pku2406#include <stdio.h>#include <stdlib.h>#include <string.h> char str [1000010];int next[1000010]; int getnext(){ int i= 0, j= -1; next[0]= -1; while( str[i] )//这个过程其实就是在求next[]数组 { if( j== -1 || str[i]== str[j] ) { ++i,++j; next[i] 阅读全文
posted @ 2011-11-07 02:46 枕边梦 阅读(284) 评论(0) 推荐(0) 编辑