Types of Binary Tree.

Types of Binary Tree.


Types of Binary Tree in Data Structure. Let's see Binary Tree types with example. There are mainly 3 types of Binary trees.

  1. Full binary tree / Proper binary tree / 2-tree / Strictly binary tree) 
  2. Perfect Binary Tree. 
  3. Complete Binary Tree:

 
Full binary tree / Proper binary tree / 2-tree / Strictly binary tree)

Full Binary Tree is a tree in which every node except leaves/leaf node has either 0 or 2 children.
There will be no leaves with only 1 child.
 

Example of Full Binary Tree: 


Perfect Binary Tree

It is same as Full Binary tree with only difference as all Leaf Node of a Tree is at same Level. 
It means all the internal nodes must have 2 children.

Example of Perfect Binary Tree:  
 

Complete Binary Tree

A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and for Last level, and all nodes are as far left as possible.
A complete binary tree is a binary tree which follows a pattern like Root, Left child and Right child while creation of nodes till its last Node is called complete binary tree,

If at any Level if Right child of a Node is Present without Left child then such a tree is not a Complete Binary Tree. For a Tree to be complete Binary Tree, It should have a Node, Left Child and a Right Child in sequence.


Example of Complete Binary Tree:  




Example of Not Complete Binary Tree:  


It is Not a complete Binary Tree because it has not followed node creation in Root node, Left child and Right child fashion.

You may also like to see


Count trailing zeros in factorial of a number.

Swap two numbers In Java without using third variable - Best Approach.

Breadth First Search(BFS) Vs Depth First Search(DFS) with example in Java

Can static method be called using object in java

Method overriding and Method hiding Interview Question in Java.

When to use SOAP over REST Web Service. Is REST better than SOAP?.


Enjoy !!!! 

If you find any issue in post or face any error while implementing, Please comment.

Post a Comment