- Read Tutorial
Before we walk through how the tree data structure can be utilized to manage data, there are some key terminologies you should become familiar with. This guide walks through each of these terms. These examples all use a binary search tree, however many of the concepts, such as nodes and edges can be applied to all trees and graphs.
Root
Definition: The very top node of a tree.
Child
Definition: Any node connected to another node, while moving away from the root node.
Parent
Definition: A node that contains child nodes
Siblings
Definition: Multiple nodes connected to the same parent node.
Leaf
Definition: A node with no child nodes.
Edge
Definition: Connection between one node to another node.
Path
Definition: A sequence of nodes connecting a node with a descendant node.
Tree Height
Definition: Number of edges in the longest path from the root to the leaf node.
Depth
Definition: Number of edges from a node to the tree's root node.
Summary
Now that you have a good idea of the key terms associated with trees you're ready to start walking through each of the key structures and how they can be used.