Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
问个关于KMP的实现的问题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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator