[問題] 程式碼問題
Show that the following brute-force string matching algoritm takes average
linear time to report all occurrences of a pattern string p in a text
string t.
1:Let m = length of p;n=length of t;
2:for i = 1 to n-m+1 do
3: j=1;
4: while j<=m and p[j]=t[i+j-1] do
5: j=j+1;
6: if j>m then
7: Print i ;
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.127.38.23
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):