Search code examples
algorithmbioinformaticssuffix-tree

Suffix Tree check existence of P pattern before k position


I need to design an algorithm that given a T string of n length, after a process O(n), for every string P of m length and a k value between 1 to n, to checks in O(m) time, if P appears on T before k position, only using Suffix Tree.

Unfortunately there are not any good bioinformatics books with fair examples and practical methodologies. Dan Gusfield book does not offer a solution manual.


Solution

  • Preprocessing: after constructing the suffix tree, use DFS to label each node with the minimum index of the suffixes that appear in its descendants.

    Query: descend in the suffix tree on the links indicated by P, threshold the node value constructed above.