3.4.1 · D1Trees

Foundations — Tree terminology — root, leaf, height, depth, degree, subtree

3,147 words14 min readBack to topic

This page builds every symbol and word the parent note uses, starting from "what is a dot and a line". If the parent note said "node" or "edge" or wrote without showing you the picture — we fix that here, from zero.


Symbol 0 — the dot (node) and the line (edge)

Before any tree, we need two things you can literally draw.

Figure s01 (below) defines node and edge visually: it shows two labelled circles (A, B) joined by one orange line, with the dot and the line each arrow-labelled so you can attach the word to the picture before reading on.

Figure — Tree terminology — root, leaf, height, depth, degree, subtree

WHY start here? Every later word — parent, child, root, leaf — is defined by which dots connect to which. If "node" and "edge" aren't concrete pictures first, none of the later words can be.


Symbol 1 — direction: parent and child

A plain line just says "connected". A tree needs a direction: one dot is above, the other below.

WHY the topic needs it: words like ancestor ("dots above you") and descendant ("dots below you") are meaningless without an agreed up/down. Parent/child is that agreement.


Symbol 2 — the special dot: root

Figure s02 (below) defines the root visually and pins down "up" versus "down": the red circle R at the top has only downward lines, and green/blue arrows label the two directions we will measure with (up toward the root, down toward the branches).

Figure — Tree terminology — root, leaf, height, depth, degree, subtree

WHY exactly one? A tree is a single hierarchy — one boss. If two dots had no parent, you'd have two separate trees, not one. The root is the anchor from which "up" is measured.


Symbol 3 — the childless dot: leaf

Now that "child" exists (Symbol 1), we can name the dots that have none.

WHY the topic needs it: the parent's height definition and the sentence "leaf has height 0" are meaningless until "leaf" is a defined word. We define it before height uses it.


Symbol 4 — the forbidden thing: cycles (no loops)

Figure s03 (below) contrasts a valid loop-free tree (green, left) against a forbidden shape with a cycle (red, right), where dot D can be reached from R two different ways. Compare the two panels: the loop is the only difference.

Figure — Tree terminology — root, leaf, height, depth, degree, subtree

WHY the topic needs it: the rule "no one can be their own ancestor" is exactly "no cycles". It is the property that separates a tree from a general graph.


Symbol 5 — the count and the number of edges

Now we can read the parent's first formula.

WHY , shown from the picture: every dot except the root has exactly one line going up to its parent (Symbol 1 + Symbol 2). That is one edge per non-root dot. There are dots total and root, so non-root dots, hence edges. The root adds none — it has no parent line. This is counted, not memorised.


Symbol 6 — counting distance in edges, then depth and height

Every "how far" measurement in this topic counts edges along a path, never dots.

With "path length = edges" fixed, the two measurements the parent uses become precise:

WHY the topic needs both: the parent's recursive formula (next section) computes , and its count bound uses the tree's height . Neither is meaningful until these two words are pinned to path length.


Symbol 7 — degree of a node, and degree of the tree

WHY the topic needs it: the parent writes "degree " in its count formula. That is precisely this tree-wide maximum, so the count bound is a guaranteed ceiling, not just a typical case.


Symbol 8 — subtree

WHY the topic needs it: the recursive height formula treats each child as the root of its own subtree and asks for that subtree's height. Without "subtree" the recursion has nothing to recurse on.


Symbol 9 — the recursive height formula (base case + step)

The parent's formula uses two pieces of notation you must own:


Symbol 10 — powers and the geometric-series bound

The parent claims .

Now the closed form is derived, not asserted:


How these foundations feed the topic

Read the map below bottom-up: node and edge (top boxes) are the raw dots and lines. Adding a direction gives parent/child, which lets us name the root (childless-above) and leaf (childless-below). "No cycles" plus the root gives the edge count. Counting in edges gives depth and height; the set of children plus gives the recursive height formula (grounded by the leaf base case). Degree per node, maxed into the tree degree , plus powers, gives the geometric-series bound. All arrows converge on the Tree Terminology topic.

Node = a dot

Edge = a line

Direction gives parent and child

Root = top dot no parent

Leaf = dot with no children

No cycles = no loops

n dots give n-1 edges

Path length counts edges

Depth and Height

Leaf height 0 base case

Children as a set

max picks the tallest child

Recursive height formula

Subtree = node plus descendants

Node degree = child count

Tree degree d = max

Powers d to the k per level

Max nodes geometric series

Tree Terminology topic


Equipment checklist

What is a node?
A single dot that holds one piece of data.
What is an edge?
A line connecting two nodes, meaning they are directly related.
If an edge goes from A down to B, who is the parent?
A is the parent, B is the child.
What makes a dot the root?
It is the single topmost node with no parent.
What is a leaf?
A node with no children, no matter what level it sits at.
What is a cycle, and does a tree allow one?
A path that loops back to the same dot; trees allow none.
Why does a tree with n nodes have n−1 edges?
Every node except the root contributes exactly one edge to its parent.
Do we measure distance in edges or in dots?
In edges — the number of lines crossed along the path.
Define depth of a node.
The number of edges from the root down to that node; the root has depth 0.
Define height of a node.
The number of edges on the longest path down to a leaf; a leaf has height 0.
What is the base case of the recursive height formula?
A leaf has height 0 (no children, no downward edge).
Node degree vs tree degree d?
Node degree = its number of children; tree degree d = the maximum degree over all nodes.
What is the subtree rooted at v?
v together with all its descendants, treated as a tree with v as local root.
Why does the height formula use and not a sum?
Height is the longest path down, which goes through the tallest child only.
What does mean and what is ?
d multiplied by itself k times; .
Sketch why .
Multiply the sum by d, subtract the original; middle terms cancel, leaving .

Connections

  • Tree Terminology — root, leaf, height, depth, degree, subtree (Hinglish) — the parent topic these foundations feed.
  • Recursion — height and subtree are defined in terms of themselves (base case + combining step).
  • Graphs — a tree is a connected graph with no cycles; compare the degree definitions.
  • Binary Trees — the special case where degree .
  • Binary Search Trees — adds an ordering rule on top of this vocabulary.
  • Tree Traversals — walk nodes using depth and level.
  • Balanced Trees (AVL, Red-Black) — control height using the count bound above.