Home » Data Structure & Algorithms » Binary Tree

Binary Tree


Binary Tree :

Before knowing binary tree,lets see what do we mean by tree ? A tree is a non linear or hierarchical data structure which can have n number of children nodes.Here n varies from  0,1,2,…,n.

In computer science, a binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.The top most node is called root node.Each node can have 0 ,1 or 2 children.Any node which has 0 children is called leaf node.In the below diagram “1” is root node and “2” and “3” are its left and right child node.Nodes  “8,”9″,”5″,”6″,”7″ are leaf nodes as these nodes do not have children.

Binary Tree Example :



Java Code for Binary Tree :

Problems :

1 : Inorder Travesral of Binary Tree 

2 : PreOrder Traversal of Binary Tree

3 : Height or Depth of Binary Tree

4 : Size of Binary Tree

5 : Level Order Traversal of Binary Tree

6 : mirror Tree of a Binary Tree

7 : Count of Leaf Nodes in  a Binary Tree

8 : Check if two trees are identical or not 

9 : Root to leaf path sum of binary Tree

Leave a comment

Your email address will not be published. Required fields are marked *

19 − 17 =