Trees In Data Structures

Tree is a type of non-linear hierarchical data structure in which there is a main node called as the ‘root node’ of the tree and there are left and right nodes of that root node called as the ‘left child’ and the ‘right child’.

Root node always should be one node.

Binary Trees

A binary tree T is defined as a finite set of elements, called nodes, such that:
  • T is empty (called the null tree or empty tree), or
  • T contains a distinguished node R, called the root of T, and the remaining nodes of T form an ordered pair of disjoint binary trees T1 and T2.
If T does contain a root R, then, the two trees T1 and T2 are called, respectively, the left and right subtree of R. If T1 is nonempty, then its root is called the left successor of R; similarly, if T2 is nonempty, then its root is called the right successor of R.


Leaf Node

A node that has no child is called as ‘leaf node’ of the tree. That means, the last node of the tree is called as the leaf node of that tree.

You May Also Like: pm kisan samman nidhi yojana

Siblings

The node with the same parent is called as ‘siblings’.
Powered by Blogger.