Suffix Trees and Suffix Arrays:Advanced Applications
Advanced Applications Su ffix Links from Lowest Common Ancestors Suppose we are given a suffix tree and it is required to establish suffix links for each internal node. This may become necessary if the suffix tree creation algorithm does not construct suffix links but they are needed for an application of interest. For example, the suffix tree may be constructed via suffix arrays, completely avoiding the construction and use of suffix links for building the tree. The links can be easily established if the tree is preprocessed for l ca queries. Mark each internal node v of the suffix tree with a pair of leaves ( i, j ) such that leaves labeled i and j are in the subtrees of different children of v . The marking can be done in linear time by a bottom-up traversal of the tree. To find the suffix link from an internal node v (other than the root) marked with ( i, j ), note that v = l ca ( i, j ) and l cp ( suf f i , suf f j ) = path - l abel ( v ). Let path - l abel ( v ) = cα , where c is the first charac...