Siblings
Tree Terminology Two nodes with the same
parent
Vertex / Node Leaf / Terminal Vertex
Node with no child
An object, entity or container
Root Non-leaf / Internal Vertex
Has at least one child
Top-most node
Edge / Arc Level / Depth of a vertex
Length of simple path (edges)
Connects a pair of vertices
from root to a node
Has 1 input and can have
Number of ancestors
several outputs
Root’s level is 0
Path of length k Height / Depth of a tree
Sequence of vertices
Maximum level among vertices
Simple path Empty tree
Path with distinct edges
No nodes
Tree T=(V,E) Degree of a vertex
Finite set of vertices V
Number of children
Edges E on V
Unique simple path between
any of vertices Degree of a tree
No cycles Maximum degree among
vertices
Rooted Tree
Tree with fixed vertex as root K-ary tree / Binary Tree
Tree with degree not more than
k
Forest Tree with degree not more than
Collection of disjoint trees
2
Degree of the tree should be
Ancestor / Above less than or equal to k (k should
Any node in the simple path be bigger than the degree)
from a vertex to the root
Ordered Tree
Descendant / Below Children of each vertex is
Any node in the simple path ordered
from a vertex to the leaf node E.g. 1st child, 2nd child
Parent Ordered Binary Tree
Immediate ancestor of a node Ordered 2-ary tree
Each child is either left or right
Child
Immediate descendant of a Left and Right Children
node Vertex on parent’s left/right
branch
CHAPTER 6 - TREES
Full Binary Tree
Binary tree where each vertex
is either a leaf or has 2 children
Complete Binary Tree
Full binary tree with all leaves at
deepest level
All levels has maximal number
of vertices
Almost Complete Binary Tree
All levels has maximal number
of vertices except possible the
last
Vertices at the last level are as
left as possible
Subtree
A tree is a subtree of itself
Empty tree is a subtree of every
other tree (improper subset)
Portion of a tree that can be
viewed as a complete tree in
itself. Any node in a tree,
together with all the nodes
below it, comprise a subtree of
the tree
Tree Theorems
1. A non-empty tree with n (n>0)
vertices has n-1 edges
2. The simple path between any
two vertices in a tree is unique
(cycle is not allowed)
3. A full binary non-empty tree with
k internal vertices has k+1 leaves
4. The number of vertices at level L
of a complete binary tree with
height h >= L >= 0, is 2^L
5. The number of vertices in a
complete binary tree of height h
is 2^h+1 – 1
6. The height h of a binary tree with
n vertices is at least lg (n+1) – 1
CHAPTER 6 - TREES