Terms II
YouTube VideoWe can describe the sizes of trees and position of nodes using different terminology, like level, depth, and height.
Level
- The level of a node characterizes the distance between the node and the root. The root of the tree is considered level 1. As you move away from the tree, the level increases by one.- For our family tree example, what nodes are in the following levels? Think about the answer and then click corresponding arrow.
Depth
- The depth of a node is its distance to the root. Thus, the root has depth zero.Level
anddepth
are related in that:level = 1 + depth
.- For our family tree example, what nodes have the following depths?
Height of a Node
- The height of a node is the longest path to a leaf descendant. The height of a leaf is zero.- For our family tree example, what nodes have the following heights?
Height of a Tree
- The height of a tree is equal to the height of the root.- Our family tree would have height 5