Tag: binary-tree


Diameter of a Binary tree

The diameter of a tree is the number of nodes on the longest path between two leaves in the tree. Here, we will try to find the diameter of a binary tree using an unoptimized solution first and the...

Maximum level sum in a binary tree

Write a program to find the maximum level sum in a binary tree even if nodes may have negative values also. To find the maximum level sum, traverse each level separately and find the sum of each le...

Number of full nodes in a binary tree

Those nodes in the tree which have both the children are known as full nodes i.e., A node is a full node if both left and right child nodes of it are present or not null. To find the number of full...

Number of half nodes in a binary tree

Those nodes in the tree which have only one child are known as half nodes i.e., A node is a half node if only one child node is present among left or right child nodes. To find the number of half n...

Number of leaf nodes in a binary tree

Those nodes in the tree which don't have any child are known as leaf nodes i.e., A node is a leaf node if both left and right child nodes of it are null. To find the number of leaf nodes in a binar...

Size of a binary tree

Find the size of a Binary tree using recursion or iterative solution. For example, a binary tree contains elements- 1, 2, 3, 4, 5, 6, 7 SIze of the binary tree will be 7.