1 Dec 2019

  • December 01, 2019
  • Amitraj
Binary Tree

-> Binary tree is a special tree data structure in which each node can have at most 2 children. 

-> In a binary tree, each node has either 0 child or 1 child or 2 children.

-> Each node contains 3 components:

   1.Pointer to left subtree
   2.Pointer to right subtree
   3.Data element




Types of Binary Trees (Based on Structure)

1. Full Binary Tree -  A full binary tree (sometimes proper binary tree or 2 tree or Strictly binary tree) is a tree in which every node other than the leaves has two children.




NOTE: A Binary Tree is a full if every node has 0 or 2 children.


2. Rooted binary tree: It has a root node and every node has at most two children. 


3. Complete Binary Tree -  It is a Binary Tree in which every level, except possibly the last, is completely filled and all nodes are as far left as possible.



4. Perfect Binary Tree -  It is a Binary tree in which all interior nodes have two children and all leaves have the same depth or same level.

-> A perfect tree is always complete but a complete tree is not necessarily perfect.

-> (2n-1) to know nodes of a perfect tree.







 
                              

Translate

Popular Posts