SlideShare a Scribd company logo
1 of 20
BINARY TREE
Submitted by:-
1. P. NITHYA, II-M.Sc., (CS & IT)
2. M. LAVANYA, II-M.Sc., (CS & IT)
3. N. PANDIMEENA, II-M.Sc., (CS &IT).
(N. S. College of Arts & Science, Theni, TamilNadu.)
BASIC TERMINOLOGY
 A Tree Structure means that the data is
organized so that items of information are
related by branches.
 Such a structure arises is in the investigation
of genealogies.
TYPES
Types of Genealogical Charts:
There are two types of genealogical charts.
 Pedigree chart:-
 The pedigree chart shows someone’Ancestors.
 Lineal chart:-
 This chart of descendants rather than ancestors and
each item can produce several others.
TREE
Definition:-
A Tree is a finite set of one or more nodes
such that:
 Root node:-
 The top node is called a root node.
 Leaf node:-
 Which node hasn’t subtree is called leaf
node.
Example :- A
B C
FED
H
G
I
LEVEL
1
2
4
3
DEGREE & FOREST
Degree:-
 The number of subtrees of a node is called its Degree. The
above example has, degree A is 2, D is 1, and H is zero.
Forest:-
 A forest is a set of n>=0 disjoint trees, The notion of a forest
is very close to that of a tree because if remove the root of a
tree and get a forest.
BINARY TREE
 Binary tree is an important type of tree structure
 Binary tree the distinguish between sub tree left an
the right
 Binary tree finite set of node
 The two disjoint tree call
i) right subtree ii) left subtree
a
b
a
b
TWO BINARY TREE
 The no tree have zero node
 I)right subtree II) left subtree
First have empty second have empty
on right subtree on left subtree
a
b
a
b
SAMPLE BINARY TREE
 The two special kinds of binary tree
 I) The non complete binary tree:-
 This is called skewed binary tree.
(i) skewed tree
a
b
 II) The complete binary tree
(ii) Complete binary tree
a
b
c
d ef
BINARY TREE REPRESENTATIONS
 A binary tree representation is perform two types.
1. List representation
2. Array representation
 A very elegant sequential representation for such
binary trees results from sequentially numbering the
nodes, starting with nodes on level 1, then those on
level 2 and so on.
 Nodes on any level are numbered from left to right.
LIST REPRESENTATION
1
2 3
4 5
6
7
8 9 10 11 12 13 14 15
A binary tree with n nodes and of depth k is
complete if its nodes correspond to the nodes which are
numbered one to n in the full binary tree of depth k.
The nodes may now be stored in a one
dimensional array, TREE , with the node numbered i being
stored in TREE(i).
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
.
(16)
A
B
-
C
-
-
-
D
.
.
.
E
A
B
C
D
E
F
G
H
I
TREE
TREE
ARRAY REPRESENTATION
This representation can clearly be used for all binary trees
thought in most cases there will be a lot of unutilized space.
For complete binary trees the representation is
ideal as no space is wasted.
In the worst case a skewed tree of depth k will
require 2k-1 spaces.
 Insertion or deletion of nodes from the middle of a
tree requires the movement of potentially many nodes
to reflect the change in level number of these nodes.
 These problem can be easily overcome through the
use of a linked representation.
 Each node will have three fields LCHILD,DATA and
RCHILD.
LCHILD RCHILD
LCHILD DATA RCHILD
Data
T
A A
O
D
O
C
OS
D
O
O E
O
A
O H
O
O G
O
O F
O
O E
O
D
CB
0 I O
Binary tree

More Related Content

What's hot

What's hot (20)

Binary tree
Binary tree Binary tree
Binary tree
 
Data Structure and Algorithms Arrays
Data Structure and Algorithms ArraysData Structure and Algorithms Arrays
Data Structure and Algorithms Arrays
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Binary tree
Binary  treeBinary  tree
Binary tree
 
Trees data structure
Trees data structureTrees data structure
Trees data structure
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
 
Binary tree traversal ppt - 02.03.2020
Binary tree traversal   ppt - 02.03.2020Binary tree traversal   ppt - 02.03.2020
Binary tree traversal ppt - 02.03.2020
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Data structures & algorithms lecture 3
Data structures & algorithms lecture 3Data structures & algorithms lecture 3
Data structures & algorithms lecture 3
 
Graph data structure and algorithms
Graph data structure and algorithmsGraph data structure and algorithms
Graph data structure and algorithms
 
Spanning trees
Spanning treesSpanning trees
Spanning trees
 
Trees
TreesTrees
Trees
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
 
Association rule mining.pptx
Association rule mining.pptxAssociation rule mining.pptx
Association rule mining.pptx
 
Dbms viva questions
Dbms viva questionsDbms viva questions
Dbms viva questions
 

Similar to Binary tree

non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of tree
Siddhi Viradiya
 
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 Binary tree (20)

binary tree.pptx
binary tree.pptxbinary tree.pptx
binary tree.pptx
 
Tree terminology and introduction to binary tree
Tree terminology and introduction to binary treeTree terminology and introduction to binary tree
Tree terminology and introduction to binary tree
 
Dsc++ unit 3 notes
Dsc++ unit 3 notesDsc++ unit 3 notes
Dsc++ unit 3 notes
 
Lecture 5 tree.pptx
Lecture 5 tree.pptxLecture 5 tree.pptx
Lecture 5 tree.pptx
 
Unit 4.1 (tree)
Unit 4.1 (tree)Unit 4.1 (tree)
Unit 4.1 (tree)
 
Unit II,III - Data Structures.pdf
Unit II,III - Data Structures.pdfUnit II,III - Data Structures.pdf
Unit II,III - Data Structures.pdf
 
7.tree
7.tree7.tree
7.tree
 
7 chapter4 trees_binary
7 chapter4 trees_binary7 chapter4 trees_binary
7 chapter4 trees_binary
 
Trees in Data Structure
Trees in Data StructureTrees in Data Structure
Trees in Data Structure
 
Lecture notes data structures tree
Lecture notes data structures   treeLecture notes data structures   tree
Lecture notes data structures tree
 
non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of tree
 
Lecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsLecture 8 data structures and algorithms
Lecture 8 data structures and algorithms
 
tree.ppt
tree.ppttree.ppt
tree.ppt
 
Trees
TreesTrees
Trees
 
Data Structure and Algorithms Binary Tree
Data Structure and Algorithms Binary TreeData Structure and Algorithms Binary Tree
Data Structure and Algorithms Binary Tree
 
Tree.pptx
Tree.pptxTree.pptx
Tree.pptx
 
Chapter 5_Trees.pdf
Chapter 5_Trees.pdfChapter 5_Trees.pdf
Chapter 5_Trees.pdf
 
TREES.pptx
TREES.pptxTREES.pptx
TREES.pptx
 
Data structure tree- advance
Data structure tree- advanceData structure tree- advance
Data structure tree- advance
 
DSA IV Unit.pptx
DSA IV Unit.pptxDSA IV Unit.pptx
DSA IV Unit.pptx
 

Recently uploaded

SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 

Recently uploaded (20)

Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 

Binary tree

  • 1.
  • 2. BINARY TREE Submitted by:- 1. P. NITHYA, II-M.Sc., (CS & IT) 2. M. LAVANYA, II-M.Sc., (CS & IT) 3. N. PANDIMEENA, II-M.Sc., (CS &IT). (N. S. College of Arts & Science, Theni, TamilNadu.)
  • 3. BASIC TERMINOLOGY  A Tree Structure means that the data is organized so that items of information are related by branches.  Such a structure arises is in the investigation of genealogies.
  • 4. TYPES Types of Genealogical Charts: There are two types of genealogical charts.  Pedigree chart:-  The pedigree chart shows someone’Ancestors.  Lineal chart:-  This chart of descendants rather than ancestors and each item can produce several others.
  • 5. TREE Definition:- A Tree is a finite set of one or more nodes such that:  Root node:-  The top node is called a root node.  Leaf node:-  Which node hasn’t subtree is called leaf node.
  • 6. Example :- A B C FED H G I LEVEL 1 2 4 3
  • 7. DEGREE & FOREST Degree:-  The number of subtrees of a node is called its Degree. The above example has, degree A is 2, D is 1, and H is zero. Forest:-  A forest is a set of n>=0 disjoint trees, The notion of a forest is very close to that of a tree because if remove the root of a tree and get a forest.
  • 8. BINARY TREE  Binary tree is an important type of tree structure  Binary tree the distinguish between sub tree left an the right  Binary tree finite set of node
  • 9.  The two disjoint tree call i) right subtree ii) left subtree a b a b
  • 10. TWO BINARY TREE  The no tree have zero node  I)right subtree II) left subtree First have empty second have empty on right subtree on left subtree a b a b
  • 11. SAMPLE BINARY TREE  The two special kinds of binary tree  I) The non complete binary tree:-  This is called skewed binary tree. (i) skewed tree a b
  • 12.  II) The complete binary tree (ii) Complete binary tree a b c d ef
  • 13. BINARY TREE REPRESENTATIONS  A binary tree representation is perform two types. 1. List representation 2. Array representation  A very elegant sequential representation for such binary trees results from sequentially numbering the nodes, starting with nodes on level 1, then those on level 2 and so on.  Nodes on any level are numbered from left to right.
  • 14. LIST REPRESENTATION 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  • 15. A binary tree with n nodes and of depth k is complete if its nodes correspond to the nodes which are numbered one to n in the full binary tree of depth k. The nodes may now be stored in a one dimensional array, TREE , with the node numbered i being stored in TREE(i).
  • 17. ARRAY REPRESENTATION This representation can clearly be used for all binary trees thought in most cases there will be a lot of unutilized space. For complete binary trees the representation is ideal as no space is wasted. In the worst case a skewed tree of depth k will require 2k-1 spaces.
  • 18.  Insertion or deletion of nodes from the middle of a tree requires the movement of potentially many nodes to reflect the change in level number of these nodes.  These problem can be easily overcome through the use of a linked representation.  Each node will have three fields LCHILD,DATA and RCHILD. LCHILD RCHILD LCHILD DATA RCHILD Data
  • 19. T A A O D O C OS D O O E O A O H O O G O O F O O E O D CB 0 I O