Skip to content

Latest commit

 

History

History

Check Whether A Binary Tree is Complete Or Not

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given a Binary Tree, write a function to check whether the given Binary Tree is a Complete Binary Tree or not.

A full binary tree is defined as a binary tree in which all nodes have either zero or two child nodes. Conversely, there is no node in a full binary tree, which has one child node.


The following tree is a complete binary tree

               10
           /       \  
         20         30  
        /  \       
      40    50  


               18
           /       \  
         15         30  
The following tree is not a complete binary tree

      1
    /    \
   2       3
          /  \   
         5    6