SlideShare a Scribd company logo
1 of 7
Download to read offline
Rooted & Binary Tree
Dr. Manish T I
Associate Professor
Dept of CSE
Adi Shankara Institute of Engineering & Technology, Kalady
manish.cs@adishankara.ac.in
• 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.
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
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.
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
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.
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

More Related Content

What's hot

Stressen's matrix multiplication
Stressen's matrix multiplicationStressen's matrix multiplication
Stressen's matrix multiplication
Kumar
 
Trees - Data structures in C/Java
Trees - Data structures in C/JavaTrees - Data structures in C/Java
Trees - Data structures in C/Java
geeksrik
 

What's hot (20)

Calculus a Functions of Several Variables
Calculus a Functions of Several Variables Calculus a Functions of Several Variables
Calculus a Functions of Several Variables
 
strassen matrix multiplication algorithm
strassen matrix multiplication algorithmstrassen matrix multiplication algorithm
strassen matrix multiplication algorithm
 
graph theory
graph theory graph theory
graph theory
 
Bipartite graph.pptx
Bipartite graph.pptxBipartite graph.pptx
Bipartite graph.pptx
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
Maximal and minimal elements of poset.pptx
Maximal and minimal elements of poset.pptxMaximal and minimal elements of poset.pptx
Maximal and minimal elements of poset.pptx
 
A* algorithm
A* algorithmA* algorithm
A* algorithm
 
Stressen's matrix multiplication
Stressen's matrix multiplicationStressen's matrix multiplication
Stressen's matrix multiplication
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
 
The Stable Marriage Problem
The Stable Marriage ProblemThe Stable Marriage Problem
The Stable Marriage Problem
 
Determinants
DeterminantsDeterminants
Determinants
 
Functions in discrete mathematics
Functions in discrete mathematicsFunctions in discrete mathematics
Functions in discrete mathematics
 
Shell sorting
Shell sortingShell sorting
Shell sorting
 
Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
binary tree.pptx
binary tree.pptxbinary tree.pptx
binary tree.pptx
 
Presentation binomial theorem
Presentation binomial theoremPresentation binomial theorem
Presentation binomial theorem
 
Tree and binary tree
Tree and binary treeTree and binary tree
Tree and binary tree
 
Trees - Data structures in C/Java
Trees - Data structures in C/JavaTrees - Data structures in C/Java
Trees - Data structures in C/Java
 
Graph Theory: Cut-Set and Cut-Vertices
Graph Theory: Cut-Set and Cut-VerticesGraph Theory: Cut-Set and Cut-Vertices
Graph Theory: Cut-Set and Cut-Vertices
 

Similar to Rooted & binary tree

Lecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsLecture 8 data structures and algorithms
Lecture 8 data structures and algorithms
Aakash deep Singhal
 

Similar to Rooted & binary tree (20)

DSA IV Unit.pptx
DSA IV Unit.pptxDSA IV Unit.pptx
DSA IV Unit.pptx
 
Binary Trees
Binary TreesBinary Trees
Binary Trees
 
Tree
TreeTree
Tree
 
Lec6
Lec6Lec6
Lec6
 
7.tree
7.tree7.tree
7.tree
 
Chapter 5_Trees.pdf
Chapter 5_Trees.pdfChapter 5_Trees.pdf
Chapter 5_Trees.pdf
 
Unit iii(dsc++)
Unit iii(dsc++)Unit iii(dsc++)
Unit iii(dsc++)
 
Review session2
Review session2Review session2
Review session2
 
Lecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsLecture 8 data structures and algorithms
Lecture 8 data structures and algorithms
 
Tree
TreeTree
Tree
 
Unit 6 tree
Unit   6 treeUnit   6 tree
Unit 6 tree
 
Lecture 10.pptx
Lecture 10.pptxLecture 10.pptx
Lecture 10.pptx
 
tutorial-tree (3).ppt
tutorial-tree (3).ppttutorial-tree (3).ppt
tutorial-tree (3).ppt
 
Trees in Data Structure
Trees in Data StructureTrees in Data Structure
Trees in Data Structure
 
B.TECH Math project
B.TECH Math projectB.TECH Math project
B.TECH Math project
 
Chap 5 Tree.ppt
Chap 5 Tree.pptChap 5 Tree.ppt
Chap 5 Tree.ppt
 
Chapter 8 ds
Chapter 8 dsChapter 8 ds
Chapter 8 ds
 
Lec20
Lec20Lec20
Lec20
 
Unit 4.1 (tree)
Unit 4.1 (tree)Unit 4.1 (tree)
Unit 4.1 (tree)
 
part4-trees.ppt
part4-trees.pptpart4-trees.ppt
part4-trees.ppt
 

More from MANISH T I

More from MANISH T I (20)

Budgerigar
BudgerigarBudgerigar
Budgerigar
 
NAAC Criteria 3
NAAC  Criteria 3NAAC  Criteria 3
NAAC Criteria 3
 
Artificial intelligence - An Overview
Artificial intelligence - An OverviewArtificial intelligence - An Overview
Artificial intelligence - An Overview
 
The future of blogging
The future of bloggingThe future of blogging
The future of blogging
 
Socrates - Most Important of his Thoughts
Socrates - Most Important of his ThoughtsSocrates - Most Important of his Thoughts
Socrates - Most Important of his Thoughts
 
Technical writing
Technical writingTechnical writing
Technical writing
 
Shannon-Fano algorithm
Shannon-Fano algorithmShannon-Fano algorithm
Shannon-Fano algorithm
 
Solar Image Processing
Solar Image Processing  Solar Image Processing
Solar Image Processing
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
 
JPEG
JPEGJPEG
JPEG
 
Colourful Living - Way of Life
Colourful Living - Way of LifeColourful Living - Way of Life
Colourful Living - Way of Life
 
Introduction to Multimedia
Introduction to MultimediaIntroduction to Multimedia
Introduction to Multimedia
 
Soft Computing
Soft ComputingSoft Computing
Soft Computing
 
Research Methodology - Methods of data collection
 Research Methodology - Methods of data collection Research Methodology - Methods of data collection
Research Methodology - Methods of data collection
 
15 lessons of lord buddha
15 lessons of lord buddha15 lessons of lord buddha
15 lessons of lord buddha
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Research Methodology - Introduction
Research  Methodology - IntroductionResearch  Methodology - Introduction
Research Methodology - Introduction
 
DBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORMDBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORM
 
Simple Dictionary Compression
Simple Dictionary CompressionSimple Dictionary Compression
Simple Dictionary Compression
 
Data Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingData Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length Encoding
 

Recently uploaded

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Recently uploaded (20)

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

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