An on-line algorithm is presented for constructing the suffix tree for a given string in time linear in the length of the string. The new algorithm has the desirable property of processing the string symbol by symbol from left to right. It always has the suffix tree for the scanned part of the string ready. The method is developed as a linear-time version of a very simple algorithm for (quadratic size) suffixtries. Regardless of its quadratic worst case this latter algorithm can be a good practical method when the string is not too long. Another variation of this method is shown to give, in a natural way, the well-known algorithms for constructing suffix automata (DAWGs).
Key wordsLinear-time algorithm Suffix tree Suffix trie Suffix automaton DAWG
Unable to display preview. Download preview PDF.
- A. Aho and M. Corasick, Efficient string matching: an aid to bibliographic search,Comm. ACM,18 (1975), 333–340.Google Scholar
- A. Amir and M.Farach, Adaptive dictionary matching,Proc. 32nd IEEE Ann. Symp. on Foundations of Computer Science, 1991, pp. 760–766.Google Scholar
- A. Apostolico, The myriad virtues of subword trees, inCombinatorial Algorithms on Words (A. Apostolico and Z. Galil, eds.), Springer-Verlag, New York, 1985, pp. 85–95.Google Scholar
- A. Blumer, J. Blumer, D. Haussier, A. Ehrenfeucht, M. T. Chen, and J. Seiferas, The smallest automaton recognizing the subwords of a text,Theoret. Comput. Sci.,40 (1985), 31–55.Google Scholar
- M. Crochemore, Transducers and repetitions,Theoret. Comput. Sci.,45 (1986), 63–86.Google Scholar
- M. Crochemore, String matching with constraints, inMathematical Foundations of Computer Science 1988 (M. P. Chytil, L. Janiga and V. Koubek, eds.), Lecture Notes in Computer Science, vol. 324, Springer-Verlag, Berlin, 1988, pp. 44–58.Google Scholar
- Z. Galil and R. Giancarlo, Data structures and algorithms for approximate string matching,J. Complexity,4 (1988), 33–72.Google Scholar
- M. Kempf, R. Bayer, and U. Güntzer, Time optimal left to right construction of position trees,Acta Inform.,24 (1987), 461–474.Google Scholar
- E. McCreight, A space-economical suffix tree construction algorithm,J. Assoc. Comput. Mach.,23 (1976), 262–272.Google Scholar
- E. Ukkonen, Constructing suffix trees on-line in linear time, inAlgorithms, Software, Architecture. Information Processing 92, vol. I (J. van Leeuwen, ed.), Elsevier, Amsterdam, 1992, pp. 484–492.Google Scholar
- E. Ukkonen, Approximate string-matching over suffix trees, inCombinatorial Pattern Matching, CPM '93 (A. Apostolico, M. Crochemore, Z. Galil, and U. Manber, eds.), Lecture Notes in Computer Science, vol. 684, Springer-Verlag, Berlin 1993, pp. 228–242.Google Scholar
- E. Ukkonen and D. Wood, Approximate string matching with suffix automata,Algorithmica,10 (1993), 353–364.Google Scholar
- P. Weiner, Linear pattern matching algorithms,Proc. IEEE 14th Ann. Symp. on Switching and Automata Theory, 1973, pp. 1–11.Google Scholar