Tree Terminology

When you first start reading about trees, the words get in the way. People say β€œroot”, β€œleaf”, β€œparent”, β€œchild”, β€œheight”, and β€œdegree” like you already know them. So the tree itself feels harder than it really is. The fix is simple. Once you learn this small set of words, every tree explanation after this starts to make sense.

So let us slow down and learn the vocabulary first. We will draw one tree. We will give every part a name. And we will keep pointing back at the same picture.

🌳 One Tree We Will Keep Pointing At

Here is the tree we will use for the whole tutorial. Look at it once. Then we will name every piece.

A

B

C

D

E

F

G

Read it from top to bottom. A sits at the very top. B and C sit below A. Then B has D and E under it. C has F under it. And E has G under it. That is the full family. Now let us name everyone.

🌱 Root: the topmost node

The root is the single node at the very top of the tree. It is the one with nothing above it. In our picture that is A. Every tree has exactly one root. And you start every walk through the tree from there. Think of it like the home screen of an app. You always begin from there and move down into the rest.

πŸ‘ͺ Parent and Child

A parent is a node that sits directly above another node and connects down to it. The node directly below it is its child.

So in our tree:

  • A is the parent of B and C.
  • B is the parent of D and E.
  • C is the parent of F.
  • E is the parent of G.

The other way around works too. B and C are children of A. G is a child of E. And so on. It is just like a real family. Every node except the root has one parent. The root has no parent, because nobody sits above it.

πŸ‘― Siblings

Siblings are nodes that share the same parent. They sit on the same line under one node.

In our tree B and C are siblings, because both have A as their parent. D and E are siblings too, since both come from B. But D and F are not siblings. They look like they sit on the same level. But they have different parents. So the rule is about the parent. It is not about the line they sit on.

Tip

Same level does not mean siblings. Only nodes with the same parent are siblings.

πŸƒ Leaf and Internal Node

A leaf is a node with no children. It is the end of a branch. Nothing grows below it.

In our tree the leaves are D, F, and G. Nothing hangs below them.

An internal node is the opposite. It has at least one child. So A, B, C, and E are internal nodes. Sometimes people call the root plus the internal nodes the β€œnon-leaf” nodes. Same idea, just a different name.

βž– Edge

An edge is the line that connects a parent to a child. It is one single link between two nodes.

Each arrow you see in our picture is one edge. A to B is an edge. B to E is an edge. E to G is an edge. Here is a small fact that helps later. A tree with n nodes always has exactly n - 1 edges. That is because every node except the root is joined to its parent by one edge.

πŸ›€οΈ Path

A path is the sequence of nodes you step through to get from one node to another. You move along edges as you go.

To go from A down to G, you step A to B to E to G. That whole chain is the path. In a tree there is only one path between any two nodes. There is never a second route. So you never get lost.

πŸ“ Level

The level tells you which row a node sits in. The root is at level 0. Its children are at level 1. Their children are at level 2, and so on. Each step down adds one.

So in our tree:

Level Nodes on that level
0 A
1 B, C
2 D, E, F
3 G

Note

Some books start counting levels from 1 instead of 0. The idea is the same. Just check which one your course uses, then stay with it.

πŸ“ Depth of a Node

The depth of a node is how many edges you cross to reach it from the root. The root has depth 0, because you are already there.

Count the edges from the top:

  • A has depth 0.
  • B and C have depth 1.
  • D, E, and F have depth 2.
  • G has depth 3.

See how the depth matches the level here? That is normal. Depth counts the edges down from the root. Level names the row. So they line up.

πŸ“Š Height of a Tree

The height is the number of edges on the longest path from the root all the way down to the deepest leaf.

In our tree the longest path is A to B to E to G. That is three edges. So the height of this tree is 3. You can also talk about the height of a single node. That is the longest path from that node down to a leaf below it. For example, the height of B is 2, because B to E to G is two edges.

Caution

Depth is measured from the root going down. Height is measured from a node going down to its deepest leaf. People mix these two up all the time, so read the question slowly.

🌿 Subtree

A subtree is any node together with everything that hangs below it. Pick any node. That node plus all the nodes under it form a smaller tree of their own.

Take B. On its own, B with D, E, and G under it is a subtree. It looks and behaves like a full little tree, with B as its own root. Every node in a tree is the root of its own subtree. This idea is why so many tree problems get solved by repeating the same steps on smaller and smaller subtrees.

πŸ”’ Degree

The degree of a node is simply how many children it has.

In our tree:

  • A has degree 2 (children B and C).
  • B has degree 2 (children D and E).
  • C has degree 1 (child F).
  • E has degree 1 (child G).
  • D, F, and G have degree 0, since they are leaves.

The degree of the whole tree is the largest degree of any single node in it. Here the biggest is 2. So this tree has degree 2.

πŸ“‹ All the Terms in One Place

Keep this table near you while you practice. Every term points back to the same tree we drew.

Term Meaning
Root The topmost node, with no parent (A).
Parent A node directly above another node.
Child A node directly below its parent.
Sibling Nodes that share the same parent.
Leaf A node with no children (D, F, G).
Internal node A node with at least one child (A, B, C, E).
Edge The link between a parent and a child.
Path The sequence of nodes from one node to another.
Level The row a node sits in, starting at 0 for the root.
Depth of a node Number of edges from the root down to that node.
Height of a tree Edges on the longest path from root to the deepest leaf.
Subtree A node plus everything below it.
Degree The number of children a node has.

⚠️ Common Mix-ups

A few of these terms trip up almost everyone at first. Watch out for these:

  • Calling two nodes siblings just because they sit on the same level. They are only siblings if they have the same parent.
  • Mixing up depth and height. Depth goes from the root down to a node. Height goes from a node down to its deepest leaf.
  • Thinking degree means total connections. Here degree means the count of children only.
  • Forgetting that the root has no parent, and a leaf has no children.

🧩 What You’ve Learned

βœ… The root is the single topmost node, and every node except the root has exactly one parent.

βœ… Parent, child, and sibling describe the family links, and siblings must share the same parent.

βœ… A leaf has no children, an internal node has at least one child, and they are joined by edges.

βœ… Level and depth are counted from the root downward, and height is the longest path from a node down to its deepest leaf.

βœ… A subtree is any node plus everything below it, and the degree of a node is just its number of children.

Check Your Knowledge

Test what you learned. Pick an answer for each question, then click Check.

  1. 1

    In a tree, what makes two nodes siblings?

    Why: Siblings are defined by sharing the same parent, not by sitting on the same level.

  2. 2

    What is the depth of the root node?

    Why: Depth counts edges from the root down, so the root itself has depth 0.

  3. 3

    Which statement best describes a leaf node?

    Why: A leaf is a node that has no children, so nothing grows below it.

  4. 4

    What is the degree of a node?

    Why: The degree of a node is simply how many children it has.

πŸš€ What’s Next?

Now that the words make sense, go back and read the big picture. Then move on to the most common tree of all.

Share & Connect