-->
Search here and hit enter....

Trees Data Structure | Part 7 | IDA using C

  Hello Viewer! how are you? I hope you are very well. Today I have learned about Tree Data Structure. below I have written whatever I learn today ...

  

trees data structure

TREES 

A Tree is a Non-Linear Data Structure that consists of a collection of nodes arranged in a hierarchy.

In all of the nodes one node is designated as the "Root Node" and the remaining nodes can be partitioned into disjoint sets such that each set is a "Sub-Tree" of the Root.

The Simplest form of the tree is the Binary Tree a binary tree consisting of "Root Node" and "Left and Right Sub-Trees" where both subtrees are also Binary Trees.

Each node contains a data element, a "Left Pointer" which points to the Left Sub-Tree and a "Right Pointer" which points to the Right Sub-Tree.


The "Root" element is the topmost node which is pointed by a "Root Pointer". 

If "Root = NULL" then the tree is empty. fig(7) shows a binary tree where "R" is the root node and "T1" and "T2" are the Left and Right Sub-Tree of "R".


Binary Tree


If "T1" is non-empty, then T1 is said to be "Left Successor" of R. likewise if "T2" is non-empty then T2 is said to be "Right Successor" of R.

In fig(7) node 2 is the Left Child and node 3 is the Right Child of the Root Node 1.


Note:-

  • The Left Sub-Tree of the Root node consists of nodes 2, 4, 5, 8, and 9. 
  • Similarly, the Right Sub-Tree of the Root node consists of nodes 3, 6, 7, 10, 11, and 12.


Advantage: Provides Quick Search, insert and delete operations.
Disadvantage: Complicated deletion algorithm.


That's All for Today! I hope You like and understand whatever I have written. If you find any error don't forget to mention it in the comment section or mail me. 💗💗

Note:- I learned this from "Data Structure using C" Book written By Reema Thareja.
FB COMMENTS ()