I'm a newbie. I've been learning about algorithms for two months now. I'm generally doing okay but I'm not good at understanding search algorithms nor implementing them. I'm particularly stuck on this pattern search algorithm, Reverse Factor. I've been researching it for a week now but I still don't completely understand it, let alone implement it. I don't have anyone I could ask but I don't want to skip any algorithms. So far I've found this algorithm. But I don't understand it well. I'm also not a native speaker. Can you help me?
the purpose is "search a pattern p in string t".
Algorithm RF /* reverse factor string matching */
/* denote t[i + j.. i + m] by x;
it is the last-scanned part of the text */
i:= 0;
while i _< n - m do
{
j:= m;
while j > 1 and x ϵ FACT(p)
do j:=j- 1;
/* in fact, we check the equivalent condition x^R ϵ FACT(p^R) */
if x = p then
report a match at position i;
shift := RF shift[x];
i := i + shift;
}
end.
Fact(p) is the set of all factors (substrings) of p.
Thank you in advance.