Understanding Tree

Tree is a fundamental data structures. It is non linear in nature. It is defined as a collection of elements(known as nodes) in which one element is special ( called as root) which represent the first element of this collection.

Applications of tree

  1. To represent hierarchical relations among elements
  2. For efficient searching through binary search tree (BST)
  3. For efficient sorting using heap (heapsort – complexity nlogn )
  4. For make efficient operations ( insert, delete, search) through self balanced tree (such as AVL tree, Red Black tree etc.)
  5. For implementing indexing in databases (B-tree, B+tree etc.)
  6. For finding shortest path trees to multiple destinations (e.g., minimum spanning tree)

Lets develop good understanding of the basic of TREE. [Click the following links to watch the video]

You are invited to raise queries by writing your question in the  box given below

Important Terms Used with Tree data Structure

  • Root − The first node of the tree is called root.
  • Parent − First ancestor of any node is called called parent (Note- Root has no parent)
  • Child − First descendant of any node is called child (Note – Leaf node has no child)
  • Leaf − The node which is terminal node (i.e. it has no child)
  • Subtree − It represents the descendants of a node.
  • Path − It refers to the sequence of connected nodes in a tree.
  • Traversing − It means visiting nodes of a tree in a specific order.
  • Levels − It represents the generation of a node (i.e root node is at level 0, then next child node is at level 1 and so on.
  • keys − It represents a value stored in a node.

Published by Expert_Talk

I like sharing article and discussion on emerging technologies. Love to share my knowledge on various latest trends and technologies.

4 thoughts on “Understanding Tree

  1. Good morning I have two question about tree is it possible that one parent has more than 3 or 4 child nodes are there any limit for using child nodes?

    Second as I watch video lecture, height of tree is maximum depths of any nodes(3) which is depths of nodes does not greater than 3 ? For example: Can I write like A is root and B, C , D, J, K and so on descendant are there any limit of descendant?

    Thank you for answering

    1. In a tree, anode can have as many childs. WIth specific tree, there is a limitation on maximum number of child.
      For example, Binary (two-way) tree can have max. 2 childs, 3-way can have maximum 3 childs. In general M-way can have maximum m-childs.

      Second question is not very clear. But the statement height of tree is maximum depths of any nodes is correct.

  2. Good evening professor, I would like to ask a question about Balancing Factor in AVL tree.
    By watching your video lecture, BF=(Height of Right subtree) – (Height of Left subtree), but in other recourses like https://www.javatpoint.com/avl-tree shows that BF=(Height of Left subtree) – (Height of Right subtree)
    Which one is correct?

    Thank you in advance.

    1. Dear Abdullo

      In practical, it does not differ whether you take R-L or L-R for finding Balancing Factor (-1 0r 1) both are balanced.
      Moreover, you need to stick to one particular notation for your operations.

      In my video lecture, I demonstrated
      1. All Insertion operations using R-L
      2. All Deletion Operations using L-R

      To make it simple, you always apply L-R for all operations (i.e. insertions & deletions)
      Hope, your confusion is resolved.

      Best Wishes

Leave a reply to Expert_Talk Cancel reply