Abstract
Suffix trees and suffix arrays are two of the most widely used data structures for text indexing. Each uses linear space and can be constructed in linear time for polynomially sized alphabets. However, when it comes to answering queries with worst-case deterministic time bounds, the prior does so in O(mlog|Σ|) time, where m is the query size, |Σ| is the alphabet size, and the latter does so in O(m+logn) time, where n is the text size. If one wants to output all appearances of the query, an additive cost of O(occ) time is sufficient, where occ is the size of the output. Notice that it is possible to obtain a worst case, deterministic query time of O(m) but at the cost of super-linear construction time or space usage.
We propose a novel way of combining the two into, what we call, a suffix tray. The space and construction time remain linear and the query time improves to O(m+log|Σ|) for integer alphabets from a linear range, i.e. Σ⊂{1,…,cn}, for an arbitrary constant c. The construction and query are deterministic. Here also an additive O(occ) time is sufficient if one desires to output all appearances of the query.
We also consider the online version of indexing, where the text arrives online, one character at a time, and indexing queries are answered in tandem. In this variant we create a cross between a suffix tree and a suffix list (a dynamic variant of suffix array) to be called a suffix trist; it supports queries in O(m+log|Σ|) time. The suffix trist also uses linear space. Furthermore, if there exists an online construction for a linear-space suffix tree such that the cost of adding a character is worst-case deterministic f(n,|Σ|) (n is the size of the current text), then one can further update the suffix trist in O(f(n,|Σ|)+log|Σ|) time. The best currently known worst-case deterministic bound for f(n,|Σ|) is O(logn) time.
Similar content being viewed by others
Notes
Note that the special $ character is a special delimiter which has only appears at the end of the text and is considered to be lexicographically larger than all of the other integers in Σ.
References
Abouelhoda, M.I., Kurtz, S., Ohlebusch, E.: Replacing suffix trees with enhanced suffix arrays. J. Discrete Algorithms 2(1), 53–86 (2004)
Aho, A.V., Hopcroft, J.E., Ullman, J.D.: The Design and Analysis of Computer Algorithms. Addison-Wesley, New York (1974)
Amir, A., Kopelowitz, T., Lewenstein, M., Lewenstein, N.: Towards real-time suffix tree construction. In: Proc. of Symp. on String Processing and Information Retrieval (SPIRE), pp. 67–78 (2005)
Breslauer, D., Italiano, G.F.: Near real-time suffix tree construction via the fringe marked ancestor problem. J. Discrete Algorithms 18, 32–48 (2013)
Cole, R., Lewenstein, M.: Multidimensional matching and fast search in suffix trees. In: Proc. of the Symposium on Discrete Algorithms (SODA), pp. 851–852 (2003)
Dietz, P.F., Sleator, D.D.: Two algorithms for maintaining order in a list. In: Proc. of Symposium on Theory of Computing (STOC), pp. 365–372 (1987)
Farach-Colton, M., Ferragina, P., Muthukrishnan, S.: On the sorting-complexity of suffix tree construction. J. ACM 47(6), 987–1011 (2000)
Franceschini, G., Grossi, R.: A general technique for managing strings in comparison-driven data structures. In: Proc. 31st Intl. Col. on Automata, Languages and Programming (ICALP). LNCS, vol. 3142, pp. 606–617 (2004)
Grossi, R., Italiano, G.F.: Efficient techniques for maintaining multidimensional keys in linked data structures. In: Proc. of the Intl. Col. on Automata, Languages and Programming (ICALP), pp. 372–381 (1999)
Kärkkäinen, J., Sanders, P., Burkhardt, S.: Linear work suffix array construction. J. ACM 53(6), 918–936 (2006)
Kim, D.K., Sim, J.S., Park, H., Park, K.: Constructing suffix arrays in linear time. J. Discrete Algorithms 3(2–4), 126–142 (2005)
Ko, P., Aluru, S.: Space efficient linear time construction of suffix arrays. J. Discrete Algorithms 3(2–4), 143–156 (2005)
Kopelowitz, T.: On-line indexing for general alphabets via predecessor queries on subsets of an ordered list. In: Proc. of the Symposium on Foundations of Computer Science (FOCS), pp. 283–292 (2012)
Lewenstein, M.: Orthogonal range searching for text indexing. In: Space-Efficient Data Structures, Streams, and Algorithms. LNCS, vol. 8066, pp. 267–302 (2013)
Manber, U., Myers, E.W.: Suffix arrays: a new method for on-line string searches. SIAM J. Comput. 22(5), 935–948 (1993)
McCreight, E.M.: A space-economical suffix tree construction algorithm. J. ACM 23, 262–272 (1976)
Mehlhorn, K.: Data Structures and Algorithms 1: Sorting and Searching. EATCS Monographs in Theoretical Computer Science. Spriger, Berlin (1984)
Ruzic, M.: Constructing efficient dictionaries in close to sorting time. In: Proc. of the Intl. Col. on Automata, Languages and Programming (ICALP), vol. 1, pp. 84–95 (2008)
Tarjan, R.E.: Data Structures and Network Algorithms. CBMS-NSF Regional Conference Series in Applied Mathematics, vol. 44. SIAM, Philadelphia (1983)
Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14, 249–260 (1995)
Weiner, P.: Linear pattern matching algorithm. In: Proc. 14th IEEE Symposium on Switching and Automata Theory, pp. 1–11 (1973)
Author information
Authors and Affiliations
Corresponding author
Additional information
Results from this paper have appeared as an extended abstract in ICALP 2006.
Cole’s work was supported in part by NSF grant CCF-1217989. Lewenstein’s research was supported by a BSF grant (#2010437) and a GIF grant (#1147/2011).
Rights and permissions
About this article
Cite this article
Cole, R., Kopelowitz, T. & Lewenstein, M. Suffix Trays and Suffix Trists: Structures for Faster Text Indexing. Algorithmica 72, 450–466 (2015). https://doi.org/10.1007/s00453-013-9860-6
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-013-9860-6