Definition of tree , tree structure, types of structure, Degree and Forest, Examples., Binary tree definitions, types of binary tree, Examples., details of binary tree representations, types of representations, examples.
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.
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.
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