Building a binary tree ADT

A binary tree is a hierarchical data structure whose behavior is similar to a tree, as it contains root and leaves (a node that has no child). The root of a binary tree is the topmost node. Each node can have at most two children, which are referred to as the left child and the right child. A node that has at least one child becomes a parent of its child. A node that has no child is a leaf. Please take a look at the following binary tree:

From the preceding binary tree diagram, we can conclude the following:

  • The root of the tree is the node of element 1 since it's the topmost node
  • The children of element 1 are element ...

Get C++ Data Structures and Algorithms 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.