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 00448264 at 2005-05-23 20:15:14 on Problem 2406
int pi[MAX];
char s[MAX + 1];

		for(i = 2; s[i] != '\0'; i++)
		{
			while(k > 0 && s[k + 1] != s[i])//这里是while还是if?
			{
				k = pi[k];
			}
			if(s[k + 1] == s[i])
			{
				k++;
			}
			pi[i] = k;
		}

注释的地方我用汇编写的时候写成了if居然也让我过了,到底是不是必须写while?(上面是照CLRS写的)

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