i2tutorials

Data Structures-Tree representation 

Tree representation 

 

The tree data structure can be represented in two ways:

  1. List representation 
  2. Left child- right sibling representation 

 

List representation

In list representation, there are two types of nodes. One node is for representing data called the “data node” and the other is for representing references called the “reference node”. 

Graphical representation is as follows:

 

 

Left child- right sibling representation

In the Left child- right sibling representation, a list with one type of node which consists of three fields namely the Data field, Left child reference field, and Right sibling reference field is used. The data field stores the actual value of the node. The left child reference node stores the address of the left child and the right sibling reference field stores the address of the right sibling.  

Graphical representation is as follows:

 

 

Reference

Tree representation 

 

Exit mobile version