Maros Hluska
2011-07-19 02:41:34 UTC
I don't understand some cases for computing the suffix skip array. If
the pattern is P = baba, what would be the array?
I had S[0] = -2, S[1] = -1, S[2] = ?, S[3] = ?
With S[2], we have the suffix a, so then we can match it to a prefix
like this?
a
baba
Now it's behind the pattern and at position (-2) + 1, so S[2] = -2?
With S[3], I am not at all sure what to do. It would give the suffix P[i
+ 1..m - 1] = P[4..3] = empty string?
If I use this suffix skip array, and follow the pseudocode on slide 33
of module 8, the algorithm seems to enter an infinite loop when I use
the text T = 'aaaaaaaaaaba' and P = 'baba'
Maros Hluska
the pattern is P = baba, what would be the array?
I had S[0] = -2, S[1] = -1, S[2] = ?, S[3] = ?
With S[2], we have the suffix a, so then we can match it to a prefix
like this?
a
baba
Now it's behind the pattern and at position (-2) + 1, so S[2] = -2?
With S[3], I am not at all sure what to do. It would give the suffix P[i
+ 1..m - 1] = P[4..3] = empty string?
If I use this suffix skip array, and follow the pseudocode on slide 33
of module 8, the algorithm seems to enter an infinite loop when I use
the text T = 'aaaaaaaaaaba' and P = 'baba'
Maros Hluska