Skip to main content

Binary Trees

  • Chapter
  • First Online:
Java Challenges
  • 2340 Accesses

Abstract

While the Collections framework provides a rich variety of real-world data structures, it unfortunately does not include trees for direct use. However, trees are helpful for various use cases and therefore desirable. Because the topic of trees is quite extensive, and not to go beyond the scope of this book, you will deal mainly with binary trees and binary search trees (BSTs) as special cases.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The class TreeMap<K,V> is implemented using a so-called red-black tree.

  2. 2.

    To be more precise, actually it’s used to represent the abstract syntax structure of the source code—not the source code itself.

  3. 3.

    The computation gets a little bit easier if you assign the index 1 to the root. Then the children have positions 2i and 2i + 1.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Inden, M. (2022). Binary Trees. In: Java Challenges. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-7395-1_9

Download citation

Publish with us

Policies and ethics