# 5: Trees

- Page ID
- 47899

A **tree** is a non-empty set with an element that is designated as the root of the tree while the remaining elements are partitioned into non-empty sets each of which is a subtree of the root.

Tree nodes have many useful properties. The **depth** of a node is the length of the path (or the number of edges) from the root to that node. The **height** of a node is the longest path from that node to its leaves. The height of a tree is the height of the root. A **leaf node** has no children—its only path is up to its parent.

See the axiomatic development of trees and its consequences for more information.

Types of trees:

**Binary:** Each node has zero, one, or two children. This assertion makes many tree operations simple and efficient.

**Binary Search:** A binary tree where any left child node has a value less than its parent node and any right child node has a value greater than or equal to that of its parent node.