Presentation on the Basics of Writing. Writing a Paragraph
Rooted & binary tree
1. Rooted & Binary Tree
Dr. Manish T I
Associate Professor
Dept of CSE
Adi Shankara Institute of Engineering & Technology, Kalady
manish.cs@adishankara.ac.in
2. • A Binary tree is defined as a tree in which there is
exactly one vertex of degree two, and each of the
remaining vertices is of degree one or three.
Introduction
• A Tree in which one vertex is distinguished from
all the others is called a Rooted tree
• A special class of rooted trees called Binary Rooted
trees.
3. VERTICES
a - Internal vertex
b - Pendant vertex
c- Internal vertex
d - Pendant vertex
e- Internal vertexe- Internal vertex
f - Pendant vertex
g - Pendant vertex
EDGES
1,2,3,4,5,6
4. Properties of Binary Tree
The number of vertices n in a binary tree is always odd.
n No: of Vertices in binary tree
p=(n+1)/2 No: of Pendant vertices in binary tree.
n-p-1 Number of vertices with degree three.
n-1 Number of edges .
p-1 Number of internal vertices in binary tree.
5. Properties of Binary Tree
From the previous diagram n=7 i.e. a odd number
Number of edges = 7-1 =6
No: of Pendant vertices in binary tree = (7+1)/2 =4
No: of vertices with degree three = 7-4-1 =2No: of vertices with degree three = 7-4-1 =2
Number of edges = 7-1 =6
Number of internal vertices in binary tree = 4-1 =3
6. Properties of Binary Tree
2k
Maximum number of vertices possible in k-level binary tree.
⌈ log2
(n+1) -1 ⌉ Minimum possible height of an n – vertex binary tree.⌈ ⌉
(n-1)/2 Maximum possible height of an n – vertex binary tree.
7. Properties of Binary Tree
From the previous diagram k=4
Max No: of vertices possible in k-level binary tree = 24
= 16
⌈⌈⌈⌈ ⌉⌉⌉⌉Min possible height of an 7 – vertex binary tree = ⌈⌈⌈⌈ log2 (7+1) -1 ⌉⌉⌉⌉
= ⌈⌈⌈⌈ log2 (8) -1 ⌉⌉⌉⌉ = ⌈⌈⌈⌈ 3 -1 ⌉⌉⌉⌉ = 2
Max possible height of an 7 – vertex binary tree = (7-1)/2 = 4