|
|
back to boardIf you have WA#3 Pay attention to the fact that sizes of strings may distinguish. Re: If you have WA#3 Posted by paarth 7 Oct 2012 19:33 I do not have to take 1st string's legth in consideration... I am doing kmp failure function tabulation... for suffix match of string b with prefixes of a and thus ... only b's string length is taken care of .... plz suggest some test case where I might be wrong.. what m doing is this -------------------------- // n is the string length of b f.resize(n+2); f[0]=-1; int x; for(int i=1;i<=n;i++) { x=f[i-1]; while(x>=0&&a[x+1]!=b[i-1]) x=f[x]; if(a[x+1]==b[i-1]) f[i]=x+1; else f[i]=-1; } -------------------------------------------- |
|
|