Course contentsShow
← Computer Science
Lesson 451 of 2,87211. Binary TreesFree lesson

Root, Parent, Child, and Sibling Nodes

Learning the fundamental relationships between nodes in a tree structure.

Root, Parent, Child, and Sibling Nodes

You'll learn the fundamental family relationships between nodes that form the structure of every tree.

The Family Tree Analogy

Just like a family tree, computer science trees describe relationships between nodes using family terminology. Understanding these relationships is essential to working with any tree structure.

Core Relationships

Root Node

The root is the topmost node in the tree — it has no parent. Every tree has exactly one root, and it's the ancestor of all other nodes. Think of it as the original founder of the family tree.

Parent Node

A parent is any node that has one or more nodes directly connected below it. The parent-child relationship defines the tree's hierarchy.

Child Node

A child is a node directly connected to and below another node. A node can have zero, one, or multiple children. A node with no children is called a leaf node.

Sibling Nodes

Siblings are nodes that share the same parent. Just like brothers and sisters in a family, sibling nodes are at the same level in the tree hierarchy and descend from a common parent.

Visualizing the Relationships

        A          ← Root (no parent)
       / \
      B   C        ← B and C are siblings (same parent A)
     / \   \       ← B is parent to D and E
    D   E   F      ← D and E are siblings; F has no siblings
  • A is the root
  • A is the parent of B and C
  • B and C are children of A
  • B and C are siblings
  • B is the parent of D and E
  • D, E, and F are leaf nodes (no children)

Key Takeaway: Understanding root, parent, child, and sibling relationships is fundamental to navigating and manipulating tree structures — every tree operation relies on these connections.