Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

问个关于kmp的问题!

Posted by xtu723 at 2007-11-13 17:37:33 on Problem 2406
                 memmove(s+1,s,lens);
		//for(i=0;i<=lens;i++)
		//	next[i]=0;
		
		i=1;next[1]=0;j=0;
		while(i<lens)
		{
			if(j==0||s[i]==s[j]) 
			{
				++i;
				++j;
				next[i]=j;	
			}
			else
				j=next[j];
		}
上面这个是根据清华的严老师的那本数据结构写的kmp算法,但是用sasass是
s 0
s 0
a 1
s 1
a 2
s 3
s 4
这个是不是有点问题啊?最后一个s是4还是1??


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator