Skip to main content Accessibility help
×
Hostname: page-component-848d4c4894-2pzkn Total loading time: 0 Render date: 2024-05-18T06:57:02.121Z Has data issue: false hasContentIssue false

8 - Trees

Published online by Cambridge University Press:  05 September 2016

Gonzalo Navarro
Affiliation:
Universidad de Chile
Get access

Summary

Trees are one of the most pervasive data structures in Computer Science. They are also one of the most striking success stories of compact data structures: We can represent a tree of n nodes using basically 2n bits instead of pointers (or machine words). Moreover, the compact representations have much richer functionality than most classical representations.

Let us distinguish two types of trees: ordinal and cardinal. Ordinal trees allow for an arbitrary number of children per node but distinguish only their order. For example, the parse tree of a program or the structure of an XML document are ordinal trees. Cardinal trees, instead, have a fixed set [1, σ] of types of children, and each node might have one or no child of each type. The most common example of a cardinal tree is the binary tree, where each node may have a left and may have a right child. Having only a left child is not the same as having only a right child; an ordinal tree cannot make this distinction. Other examples are digital trees or tries (see Section 8.5.3), which have an alphabet [1, σ] and there can be at most one child for each alphabet symbol.

In addition, trees can be labeled, meaning that edges have an associated label from an alphabet [1, σ]. For example, an XML tree can be regarded as a labeled tree if we associate the tag names with their corresponding edges. Unlike a trie, a labeled tree node may have several children with the same label, and they can appear in any order. Thus, a cardinal tree can be regarded as a special type of labeled tree. An alternative model labels the nodes, not the edges. The two models are not very different, as we can assign the label of the node to the edge that leads to it (making an exception for the root). Thus, we will consider only labels at the edges.

We will mainly consider ordinal trees in this chapter and show how the solutions are extended to cardinal and labeled trees. In Chapter 2 we showed that bits are necessary to represent the topology of every possible ordinal tree of n nodes.

Type
Chapter
Information
Compact Data Structures
A Practical Approach
, pp. 211 - 278
Publisher: Cambridge University Press
Print publication year: 2016

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Adjeroh, D., Bell, T., and Mukherjee, A. (2008). The Burrows-Wheeler Transform: Data Compression, Suffix Arrays, and Pattern Matching. Springer.
Arroyuelo, D., Cánovas, R., Navarro, G., and Sadakane, K. (2010). Succinct trees in practice. In Proc. 12th Workshop on Algorithm Engineering and Experiments (ALENEX), pages 84–97.Google Scholar
Arroyuelo, D., Navarro, G., and Sadakane, K. (2012). Stronger Lempel-Ziv based compressed text indexing. Algorithmica, 62(1), 54–101.Google Scholar
Arroyuelo, D., Claude, F., Maneth, S., Mäkinen, V., Navarro, G., Nguy∼ˆen, K., Sirén, J., and Välimäki, N. (2015). Fast in-memory XPath search using compressed indexes. Software Practice and Experience, 45(3), 399–434.Google Scholar
Belazzougui, D., Puglisi, S. J., and Tabei, Y. (2015). Access, rank, select in grammar-compressed strings. In Proc. 23rd Annual European Symposium on Algorithms (ESA), LNCS 9294, pages 142– 154.Google Scholar
Bell, T. C., Cleary, J., and Witten, I. H. (1990). Text Compression. Prentice Hall.
Benoit, D., Demaine, E. D., Munro, J. I., Raman, R., Raman, V., and Rao, S. S. (2005). Representing trees of higher degree. Algorithmica, 43(4), 275–292.Google Scholar
Bille, P., Landau, G. M., Raman, R., Sadakane, K., Rao, S. S., and Weimann, O. (2015). Random access to grammar-compressed strings and trees. SIAM Journal on Computing, 44(3), 513–539.Google Scholar
Charikar, M., Lehman, E., Liu, D., Panigrahy, R., Prabhakaran, M., Sahai, A., and Shelat, A. (2005). The smallest grammar problem. IEEE Transactions on Information Theory, 51(7), 2554–2576.Google Scholar
Chiang, Y. T., Lin, C. C., and Lu, H.-I. (2005).Orderly spanning treeswith applications. SIAM Journal on Computing, 34(4), 924–945.Google Scholar
Clark, D. R. (1996). Compact PAT Trees. Ph.D. thesis, University of Waterloo, Canada.
Clark, D. R. and Munro, J. I. (1996). Efficient suffix trees on secondary storage. In Proc. 7th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 383–391.Google Scholar
Claude, F. and Navarro, G. (2010). Self-indexed grammar-based compression. Fundamenta Informaticae, 111(3), 313–337.Google Scholar
Claude, F., Nicholson, P. K., and Seco, D. (2014). On the compression of search trees. Information Processing and Management, 50(2), 272–283.Google Scholar
Crochemore, M. and Rytter, W. (2002). Jewels of Stringology. World Scientific.
Davoodi, P., Navarro, G., Raman, R., and Rao, S. S. (2014). Encoding range minima and range top-2 queries. Philosophical Transactions of the Royal Society A, 372(20130131).Google Scholar
Delpratt, O., Rahman, N., and Raman, R. (2006). Engineering the LOUDS succinct tree representation. In Proc. 5th International Workshop on Experimental Algorithms (WEA), LNCS 4007, pages 134–145.Google Scholar
Farzan, A. and Munro, J. I. (2014). A uniform paradigm to succinctly encode various families of trees. Algorithmica, 68(1), 16–40.Google Scholar
Fischer, J. and Heun, V. (2011). Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM Journal on Computing, 40(2), 465–492.Google Scholar
Fredkin, E. (1960). Trie memory. Communications of the ACM, 3, 490–500.Google Scholar
Geary, R. F., Rahman, N., Raman, R., and Raman, V. (2006a). A simple optimal representation for balanced parentheses. Theoretical Computer Science, 368(3), 231–246.Google Scholar
Geary, R. F., Raman, R., and Raman, V. (2006b). Succinct ordinal trees with level-ancestor queries. ACM Transactions on Algorithms, 2(4), 510–534.Google Scholar
González, R., Navarro, G., and Ferrada, H. (2014). Locally compressed suffix arrays. ACM Journal of Experimental Algorithmics, 19(1), article 1.Google Scholar
Graham, R. L., Knuth, D. E., and Patashnik, O. (1994). Concrete Mathematics – A Foundation for Computer Science. Addison-Wesley, 2nd edition.
Grossi, R. and Ottaviano, G. (2014). Fast compressed tries through path decompositions. ACM Journal of Experimental Algorithmics, 19(3), article 4.Google Scholar
He, M., Munro, J. I., and Rao, S. S. (2012). Succinct ordinal trees based on tree covering. ACM Transactions on Algorithms, 8(4), article 42.Google Scholar
He, M., Munro, J. I., and Zhou, G. (2014). A framework for succinct labeled ordinal trees over large alphabets. Algorithmica, 70(4), 696–717.Google Scholar
Jacobson, G. (1989). Space-efficient static trees and graphs. In Proc. 30th IEEE Symposium on Foundations of Computer Science (FOCS), pages 549–554.Google Scholar
Jansson, J., Sadakane, K., and Sung, W.-K. (2012). Ultra-succinct representation of ordered trees with applications. Journal of Computer and System Sciences, 78(2), 619–631.Google Scholar
Joannou, S. and Raman, R. (2012). Dynamizing succinct tree representations. In Proc. 11th International Symposium on Experimental Algorithms (SEA), LNCS 7276, pages 224–235.Google Scholar
Katajainen, J. and Mäkinen, E. (1990). Tree compression and optimization with applications. International Journal of Foundations of Computer Science, 1(4), 425–448.Google Scholar
Kieffer, J. C. and Yang, E.-H. (2000). Grammar-based codes: A new class of universal lossless source codes. IEEE Transactions on Information Theory, 46(3), 737–754.Google Scholar
Konow, R., Navarro, G., Clarke, C. L. A., and López-Ortiz, A. (2013). Faster and smaller inverted indices with treaps. In Proc. 36th Annual International ACM Conference on Research and Development in Information Retrieval (SIGIR), pages 193–202.Google Scholar
Larsson, J. and Moffat, A. (2000). Off-line dictionary-based compression. Proceedings of the IEEE, 88(11), 1722–1732.Google Scholar
Lu, H.-I. and Yeh, C. (2008). Balanced parentheses strike back. ACM Transactions on Algorithms, 4(3), 1–13.Google Scholar
Manber, U. and Myers, G. (1993). Suffix arrays: a new method for on-line string searches. SIAM Journal on Computing, 22(5), 935–948.Google Scholar
Martínez-Prieto, M. A., Brisaboa, N., Cánovas, R., Claude, F., and Navarro, G. (2016). Practical compressed string dictionaries. Information Systems, 56, 73–108.Google Scholar
Morrison, D. (1968). PATRICIA – practical algorithm to retrieve information coded in alphanumeric. Journal of the ACM, 15(4), 514–534.Google Scholar
Munro, J. I. and Raman, V. (2001). Succinct representation of balanced parentheses and static trees. SIAM Journal on Computing, 31(3), 762–776.Google Scholar
Munro, J. I., Raman, V., and Rao, S. S. (2001). Space efficient suffix trees. Journal of Algorithms, 39(2), 205–222.Google Scholar
Munro, J. I., Raman, R., Raman, V., and Rao, S. S. (2012). Succinct representations of permutations and functions. Theoretical Computer Science, 438, 74–88.Google Scholar
Muthukrishnan, S. (2002). Efficient algorithms for document retrieval problems. In Proc. 13th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 657–666.Google Scholar
Navarro, G. and Ordónez, A. (2014). Grammar compressed sequences with rank/select support. In Proc. 21st International Symposium on String Processing and Information Retrieval (SPIRE), LNCS 8799, pages 31–44.Google Scholar
Navarro, G. and Ordónez, A. (2016). Faster compressed suffix trees for repetitive text collections. Journal of Experimental Algorithmics, 21(1), article 1.8.Google Scholar
Navarro, G. and Sadakane, K. (2014). Fully-functional static and dynamic succinct trees. ACMTransactions on Algorithms, 10(3), article 16.Google Scholar
Otter, R. (1948). The number of trees. Annals of Mathematics, 49, 583–599.Google Scholar
Raman, R. and Rao, S. S. (2013). Succinct representations of ordinal trees. In Space-Efficient Data Structures, Streams, and Algorithms, LNCS 8066, pages 319–332. Springer.Google Scholar
Raman, R., Raman, V., and Rao, S. S. (2007). Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Transactions on Algorithms, 3(4), article 43.Google Scholar
Sadakane, K. (2007). Compressed suffix trees with full functionality. Theory of Computing Systems, 41(4), 589–607.Google Scholar
Sadakane, K. and Grossi, R. (2006). Squeezing succinct data structures into entropy bounds. In Proc. 17th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1230–1239.Google Scholar
Seidel, R. and Aragon, C. R. (1996). Randomized search trees. Algorithmica, 16(4/5), 464–497.Google Scholar
Storer, J. A. (1977). NP-completeness results concerning data compression. Technical Report 234, Department of Electrical Engineering and Computer Science, Princeton University.
Storer, J. A. and Szymanski, T. G. (1982). Data compression via textual substitution. Journal of the ACM, 29(4), 928–951.Google Scholar
Tabei, Y., Takabatake, Y., and Sakamoto, H. (2013). A succinct grammar compression. In Proc. 24th Annual Symposium on Combinatorial Pattern Matching (CPM), LNCS 7922, pages 235–246.Google Scholar
Teuhola, J. (2011). Interpolative coding of integer sequences supporting log-time random access. Information Processing and Management, 47(5), 742–761.Google Scholar
Tsur, D. (2014). Succinct representation of labeled trees. Theoretical Computer Science, 562, 320–329.Google Scholar
Verbin, E. and Yu, W. (2013). Data structure lower bounds on random access to grammar-compressed strings. In Proc. 24th Annual Symposium on Combinatorial Pattern Matching (CPM), LNCS 7922, pages 247–258.Google Scholar
Vuillemin, J. (1980).Aunifying look at data structures. Communications of the ACM, 23(4), 229–239.
Weiner, P. (1973). Linear pattern matching algorithm. In Proc. 14th Annual IEEE Symposium on Switching and Automata Theory, pages 1–11.Google Scholar
Ziv, J. and Lempel, A. (1978). Compression of individual sequences via variable length coding. IEEETransactions on Information Theory, 24(5), 530–536.Google Scholar

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Trees
  • Gonzalo Navarro, Universidad de Chile
  • Book: Compact Data Structures
  • Online publication: 05 September 2016
  • Chapter DOI: https://doi.org/10.1017/CBO9781316588284.009
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Trees
  • Gonzalo Navarro, Universidad de Chile
  • Book: Compact Data Structures
  • Online publication: 05 September 2016
  • Chapter DOI: https://doi.org/10.1017/CBO9781316588284.009
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Trees
  • Gonzalo Navarro, Universidad de Chile
  • Book: Compact Data Structures
  • Online publication: 05 September 2016
  • Chapter DOI: https://doi.org/10.1017/CBO9781316588284.009
Available formats
×