Mental Model
A tree is a set of connected points where one is the start (root), some have no children (leaves), and each point has a position measured by height, depth, and level.
Analogy: Think of a family tree: the oldest ancestor is the root, youngest family members with no children are leaves, height is how far the longest branch goes down, depth is how far a person is from the ancestor, and level groups people by generation.
Root (A)
/ \
B C
/ \ \
D E F
Legend:
- Root: A
- Leaves: D, E, F
- Height of tree: 2 (longest path from A to D or F)
- Depth of node E: 2 (steps from A to E)
- Level 0: A
- Level 1: B, C
- Level 2: D, E, F