Rooted trees
Introduction / Definition
A rooted tree is a tree with one distinguished vertex called the root. The root creates parent-child relationships and levels. Rooted trees are used in file systems, syntax trees, search trees, and organizational structures. Every non-root vertex has a unique parent on the path to the root.
Syntax / Mathematical Form
Rooted tree = (T,r), r∈V(T)
Detailed Explanation
The depth of a vertex is its distance from the root. Children are adjacent vertices one level farther from the root, while the parent is one level closer. A subtree is a node together with its descendants.
Example / Worked Example
Root r has children A and B; A has child C. Then depth(r)=0, depth(A)=1, depth(C)=2.
Output / Result
C has parent A and depth 2.
Important Points / Notes
- Root has no parent.
- Each non-root vertex has one parent.
- Depth and height describe levels.
Mini Practice Question
In a rooted tree, what is the parent of a vertex at depth 1?