Fin开发者_如何学JAVAding the Lowest Internal Node in case of suffix trees is used in many applications. For example, the lowest common internal node of strings in a generalized suffix tree would give the Longest Common Substring.
But I could not think of a way to get the Lowest Internal node in a method better than O(N*K) where N = Number of keys and K= Average length of the Keys. Is there an easier way to keep track of this node ?
http://en.wikipedia.org/wiki/Longest_common_substring_problem#Suffix_tree says that O(N*K)
is indeed the best you can do with a normal suffix tree. However it can be preprocessed in a way that makes answering the question much easier. That leads to http://en.wikipedia.org/wiki/Lowest_common_ancestor which has multiple links to external algorithms.
I would suggest starting there.
精彩评论