Tree Representations
Tree Representations
A tree data structure can be represented in two methods. Those methods are as follows...
1. List Representation
1. List Representation
In this representation, we use two types of nodes one for representing the node with data called
'data node' and another for representing only references called 'reference node'. We start with a
'data node' from the root node in the tree. Then it is linked to an internal node through a
'reference node' which is further linked to any other node directly. This process repeats for all the
The above example tree can be represented using List representation as follows...
2. Left Child - Right Sibling Representation
In this representation, we use a list with one type of node which consists of three fields namely
Data field, Left child reference field and Right sibling reference field. Data field stores the actual
value of a node, left reference field stores the address of the left child and right reference field
stores the address of the right sibling node. Graphical representation of that node is as follows...
In this representation, every node's data field stores the actual value of that node. If that node
has left a child, then left reference field stores the address of that left child node otherwise stores
NULL. If that node has the right sibling, then right reference field stores the address of right
The above example tree can be represented using Left Child - Right Sibling representation as
follows...
tree data structure in which every node can have a maximum of 2 children. One is known as a
A tree in which every node can have a maximum of two children is called Binary Tree.
In a binary tree, every node can have either 0 children or 1 child or 2 children but not more than 2
children.
Example
In a binary tree, every node can have a maximum of two children. But in strictly binary tree, every
node should have exactly two children or none. That means every internal node must have
A binary tree in which every node has either two or zero number of children is called
Strictly binary tree is also called as Full Binary Tree or Proper Binary Tree or 2-Tree
Strictly binary tree data structure is used to represent mathematical expressions.
Example
In a binary tree, every node can have a maximum of two children. But in strictly binary tree, every
node should have exactly two children or none and in complete binary tree all the nodes must
have exactly two children and at every level of complete binary tree there must be 2 level number of
nodes. For example at level 2 there must be 22 = 4 nodes and at level 3 there must be 2 3 = 8
nodes.
A binary tree in which every internal node has exactly two children and all leaf nodes are
A binary tree can be converted into Full Binary tree by adding dummy nodes to existing nodes
wherever required.
The full binary tree obtained by adding dummy nodes to a binary tree is called as
pink colour).
PreviousNext
Place your ad here
Place your ad here
Courses | Downloads | About Us | Contcat Us