某莎通过4年滴研究,数个月滴技术攻关,这个笨莎终于写出了第一个KMP算法~~~~~~^_^~~~~大家鼓励下~~~~~
核心程序发下:
procedure cpi();
var
p,q:integer;
begin
pi[0]:=0;
q:=0;
for p:=1 to lt-1 do
begin
while (t[p+1]<>t[q+1]) and (q>0) do
q:=pi[q];
if t[p+1]=t[q+1] then
inc(q);
pi[p+1]:=q;
end;
end;
function match():integer;
var
p,q:integer;
begin
q:=0;
match:=0;
for p:=0 to ls-1 do
begin
while (s[p+1]<>t[q+1]) and (q>0) do
q:=pi[q];
if s[p+1]=t[q+1] then
inc(q);
if q=lt then
begin
inc(match);
q:=pi[q];
end;
end;
end;
某笨莎突然很想写一个可爱滴KMP算法详解滴说~~~~不过写成虾米样子好捏?~~~~
=========================偶系快乐滴分割线^_^~~=============================
昨天滴一个访问记录很有意思~~~~大家欣赏下:
http://www.google.co.jp/search?hl=ja&suggon=0&q=%E6%97%85%E8%A1%8C%E5%AE%B6+%E9%97%AE%E9%A2%98&lr=lang_zh-CN
BTW.偶发现其实blog滴背景音乐只设一首就好了~~~~~MS其它滴几首很少会有网友会听滴说~~~~=。=