11.1 Introduction To Trees: Theorem 1
11.1 Introduction To Trees: Theorem 1
Theorem 1
An undirected graph is a tree if and only if there is a unique simple path between any two of its
vertices.
Forest
Rooted Trees
A rooted tree is a tree in which one vertex has been designated as the root and every edge is directed
away from the root.
Parent
Suppose that T is a rooted tree. If v is a vertex in T other than the root, the parent of v is the unique
vertex u such that there is a directed edge from u to v.
Child
1
ICS 241: Discrete Mathematics II (Spring 2015)
Siblings
Ancestors
The ancestors of a vertex other than the root are the vertices in the path from the root to this vertex,
excluding the vertex itself and including the root.
Descendants
Leaf
Internal Vertices
Subtree
If a is a vertex in a tree, the subtree with a as its root is the subgraph of the tree consisting of a and
its descendants and all edges incident to these descendants.
m-ary Tree
A rooted tree is called an m-ary tree if every internal vertex has no more than m children. The tree
is called a full m-ary tree if every internal vertex has exactly m children.
Binary Tree
2
ICS 241: Discrete Mathematics II (Spring 2015)
An ordered rooted tree is a rooted tree where the children of each internal vertex are ordered.
b c
d e f g
h i j k l m n o
In an ordered binary tree, the first child is called the left child and the second child is called the
right child.
The tree rooted at the left child is called the left subtree and the tree rooted at the right child is
called the right subtree.
Theorem 2
Theorem 3
Theorem 4
Level
The level of a vertex v in a rooted tree is the length of the unique path from the root to this vertex.
3
ICS 241: Discrete Mathematics II (Spring 2015)
Height
The height of a rooted tree is the maximum of the levels of vertices. In other words, the height of
a rooted tree is the length of the longest path from the root to any vertex.
Balanced
Theorem 5
Corollary 1
If an m-ary tree of height h has l leaves, then h ≥ dlogm le. If the m-ary tree is full and balanced,
then h = dlogm le.
a )
b )
c )
4
ICS 241: Discrete Mathematics II (Spring 2015)
d )
b c d
e f g h i j k
l m n o p q r
s t
5
ICS 241: Discrete Mathematics II (Spring 2015)
Is the rooted tree in Exercise 3 a full m-ary tree for some positive integer m?
This m-ary tree is valid for all m ≥ 3. However, the tree is not a full m-ary tree because it has
vertices that have 3, 2, or 1 children.
a) a.
6
ICS 241: Discrete Mathematics II (Spring 2015)
b c d
e f g h i j k
l m n o p q r
s t
b) c.
g h
o p
c) e.
How many edges does a full binary tree with 1000 internal vertices have?
A full binary tree has two edges for each internal vertex. So we’ll just multiply the number of
internal vertices by the number of edges.
1000 · 2 = 2000 edges
7
ICS 241: Discrete Mathematics II (Spring 2015)
Suppose 1000 people enter a chess tournament. Use a rooted tree model of the tournament to de-
termine how many games must be played to determine a champion, if a player is eliminated after
one loss and games are played until only one entrant has not lost. (Assume there are no ties.)
We can model this tournament with a full binary tree. We know we have 1000 leaves for this tree
because we have 1000 people. Each internal vertex will represent the winner of the game played
by its children. The root will be the winner of the tournament. By Theorem 4(3) with m = 2 and
l = 1000. We know that:
l−1
i=
m−1
1000 − 1
=
2−1
999
=
1
= 999
We have 999 internal vertices, so we know 999 games must be played to determine the champion.