Category: Binary Tree

Binary Trees

Check if a Binary Tree is Symmetric or not

Given a binary tree, write an efficient algorithm to check if it is symmetric binary tree or not. i.e. left subtree and right subtree are mirror images or each other.   Get great deals at Amazon

Find Diameter of a Binary Tree

Given a binary tree, write an efficient algorithm to compute the diameter of it. The diameter of a binary tree is equal to number of nodes on the longest path between any two leaves in it.  

Check if given binary tree is a sum tree or not

Given a binary tree, check if it is a sum tree or not. In a sum tree, value at each non-leaf node is equal to the sum of all elements present in its left and right subtree. The value of a leaf node can be anything.  

In-place convert given binary tree to its sum tree

Given a binary tree, in-place convert it to its sum tree. In a sum tree, value at each node is equal to the sum of all elements present in its left and right subtree. The value of an empty node is considered as 0.  

Print Top View of Binary Tree

Given an binary tree, print top view of it. Assume, the left and right child of a node makes 45 degree angle with the parent.

Print Bottom View of Binary Tree

Given an binary tree, print bottom view of it. Assume, the left and right child of a node makes 45 degree angle with the parent.