11 Binary search trees: A balanced container

In this chapter

  • modeling hierarchical relationships with trees
  • binary, ternary, and n-ary trees
  • introducing data constraints into binary trees: binary search trees
  • evaluating the performance of binary search trees
  • discovering how balanced trees provide better guarantees

This chapter marks a shift from the previous few chapters, where we focused on containers. Here, we discuss trees, which is a data structure—or rather a class of data structures! Trees can be used to implement several abstract data types, so unlike the other chapters, we won’t have an ADT section here. We’ll go straight to the point, describing trees, and then focus on one particular kind of tree—the binary search tree (BST). We’ll ...

Get Grokking Data Structures now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.