LOGBOOK

HELP

Quiz Entry - updated: 2026.09.29

Why does a tree with $n$ nodes have exactly $n - 1$ edges?

Every node except the root has exactly one edge to its parent, and every edge connects a node to its parent, so the edges correspond one-to-one to the $n - 1$ non-root nodes. By induction: one node has 0 edges, and adding a node always adds exactly one edge.

Direct argument. Pair each edge with the child at its lower end. Every non-root node has exactly one parent, so it owns exactly one edge; the root has no parent and owns none. So there are exactly as many edges as non-root nodes: $n - 1$.

By induction, the proof method for statements about all $n$:

  1. Base case $n = 1$: a single node, no edges. $1 - 1 = 0$. ✓
  2. Step $n \to n + 1$: a new node joins the tree by being attached to one existing node, as its child. That adds exactly one edge. If the tree had $n - 1$ edges before, it now has $n$, which is $(n + 1) - 1$. ✓

The fact is useful in running-time analysis: a traversal that follows every edge once does $n - 1$ steps along edges, which is another way of seeing that traversals are $O(n)$. It holds for every tree, binary or not.

Go deeper:

  • doc Tree (graph theory) — the equivalent characterisations of a tree, including "connected with $n - 1$ edges".

From Quiz: ADS / Trees: Structure, Storage and Traversals | Updated: Sep 29, 2026