0% found this document useful (0 votes)
89 views7 pages

Tree Representations

The document discusses two methods for representing tree data structures: list representation and left child-right sibling representation. It also defines different types of binary trees, including strictly binary trees, complete binary trees, and extended binary trees. Strictly binary trees require every node to have two children or none, complete binary trees require all nodes to be filled at the lowest level, and extended binary trees are created by adding dummy nodes to normal binary trees to make them full binary trees.

Uploaded by

Bandi Sirisha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views7 pages

Tree Representations

The document discusses two methods for representing tree data structures: list representation and left child-right sibling representation. It also defines different types of binary trees, including strictly binary trees, complete binary trees, and extended binary trees. Strictly binary trees require every node to have two children or none, complete binary trees require all nodes to be filled at the lowest level, and extended binary trees are created by adding dummy nodes to normal binary trees to make them full binary trees.

Uploaded by

Bandi Sirisha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Tree Representations

A tree data structure can be represented in two methods. Those methods are as follows...

1. List Representation

2. Left Child - Right Sibling Representation

Consider the following tree...

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

nodes in the tree.

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

sibling node otherwise stores NULL. 

The above example tree can be represented using Left Child - Right Sibling representation as

follows...
         

Binary Tree Datastructure


In a normal tree, every node can have any number of children. A binary tree is a special type of

tree data structure in which every node can have a maximum of 2 children. One is known as a

left child and the other is known as right child.

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

There are different types of binary trees and they are...

1. Strictly Binary Tree

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

exactly two children. A strictly Binary Tree can be defined as follows...

A binary tree in which every node has either two or zero number of children is called

Strictly Binary Tree

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

2. Complete Binary Tree

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

at same level is called Complete Binary Tree.

Complete binary tree is also called as Perfect Binary Tree

3. Extended Binary Tree

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

Extended Binary Tree.


In above figure, a normal binary tree is converted into full binary tree by adding dummy nodes (In

pink colour).

 PreviousNext 
Place your ad here
Place your ad here

Courses | Downloads | About Us | Contcat Us

Website designed by Rajinikanth B

You might also like