I recently encounter a question about suffix tree. Assume we already have a suffix tree for string S=AB, i.e., S is a concatenation of prefix A and suffix B of S. Now we want to build suffix tree U=ACB. What is the most efficient algorithm for this task so far?
A naive way would be to rebuild U all over again, which can be done in O(|U|) time. But it will not utilize any information of suffix tree of S. Can we do better than O(|U|)? Maybe O(|C|), i.e., as good as building a suffix tree of just C?
Thanks very much.
Based on Googling "dynamic suffix tree", I think this is probably an area of active research. I was able to find the paper
Paolo Ferragina and Roberto Grossi, "Fast incremental text editing", Proceedings of the sixth annual ACM-SIAM symposium on Discrete algorithms, pp. 531-540, 1995
This isn't the first (or probably the last) word on the topic, and I only skimmed part of it, but they present several variations on suffix trees that achieve better times when strings are inserted, deleted or changed. After the u-th substring insertion: