Search code examples
suffix-arrayboyer-moore

Constructing a Good Suffix Table - Understanding an example


I'm really trying to understand an example on how to construct a good suffix table for a given pattern. The problem is, I'm unable to wrap my head around it. I've looked at numerous examples, but do not know where the numbers come from.

So here goes: The following example is a demonstration of how to construct a Good Suffix Table given the pattern ANPANMAN:

Index | Mismatch | Shift | goodCharShift
-----------------------------------------------
  0   |         N|   1   | goodCharShift[0]==1
  1   |        AN|   8   | goodCharShift[1]==8
  2   |       MAN|   3   | goodCharShift[2]==3
  3   |      NMAN|   6   | goodCharShift[3]==6
  4   |     ANMAN|   6   | goodCharShift[4]==6
  5   |    PANMAN|   6   | goodCharShift[5]==6
  6   |   NPANMAN|   6   | goodCharShift[6]==6
  7   |  ANPANMAN|   6   | goodCharShift[7]==6

Any help on this matter is highly appreciated. I simply don't know how to get to these numbers. Thanks!


Solution

  • It might help you Good Suffix-Table.

    why you didnt try with last occurrence method its much easy as compared to good suffix table.I used last occurrence method for my searching