/    /  Data Structures-Tree in Data Structure

Tree in Data Structure

 

A tree is a data structure that represents hierarchical data. We define it as a collection of objects or entities known as nodes that are linked to represent or simulate hierarchy. It is also a non-linear structure, as it does not store the data sequentially. 

 

Properties of a tree data structure:

  1. We know it to be a recursive data structure. 
  2. The number of edges in the tree data structure is one less than the number of nodes.
  3. The depth of the node is equal to the length of the path from the root to the node. 
  4. The height of the node is equal to the longest path from the specified node to the leaf node. 

 

Implementation of the tree:

The tree data structure is created by creating the nodes with the help of pointers.

In programming it can be:

 

Types of trees:

There are five types of tree structures:

  1. General Tree
  2. Binary Tree
  3. Binary Search Tree
  4. AVL Tree
  5. Red-Black Tree

 

Reference

Tree in Data Structure