Good-Suffix Heuristic

Propose to shift the pattern to the right by the least amount that guarantees not to skip any occurrence of the good-suffix already matched.

T = abbbaabab
           ||
P =    cabaab
P =       cabaab

$\gamma[j] = m - \mbox{max}\{k:0 \le k < m\ \mbox{and}\ P[j+1..m]\sim
P_k\}$. In example above, j = 4, want maximum k such that $P[5..6]=\mbox{\tt ab} \sim P_k$.

\begin{eqnarraystar}
P_1 &=& \mbox{\tt c} \ P_2 &=& \mbox{\tt ca}\ P_3 &=& \mbox{\tt cab}\ P_4 &=& \mbox{\tt caba}\ P_5 &=& \mbox{\tt cabaa}\end{eqnarraystar}

So, $\gamma[4] = 3$.


next up previous
Next: Good-Suffix Heuristic Algorithm Up: BOYER-MOORE Previous: Similarity Relation