# Category: Binary Tree

Binary Trees

## Find maximum sum path between two leaves in a binary tree

Given a binary tree, write an efficient algorithm to find maximum sum path between any two leaves in it.   Get great deals at Amazon

## Find all nodes at given distance from leaf nodes in a binary tree

Given a binary tree, write an efficient algorithm to find all nodes present at given distance from any leaf node. We need to find only those nodes that are present in root-to-leaf path for that leaf.

## Count all subtrees having same value of nodes in a binary tree

Given a binary tree, count all subtrees in it such that every node in the subtree have same value.

## Find inorder successor for given key in a BST

Given a BST, find inorder successor of a given key in it. If the given key do not lie in the BST, then return the next greater key (if any) present in the BST.

## Find Maximum Difference Between a Node and its Descendants in a Binary Tree

Given a binary tree, find maximum difference between a node and its descendants in it.

## Print Right View of a Binary Tree

Given a binary tree, write an efficient algorithm to print right view of given binary tree.

## Print leaf to root path for every leaf node in a binary tree

Given a binary tree, write an iterative algorithm to print leaf to root path for every leaf node of binary tree. Use of Recursion is prohibited.

## Find maximum width of given binary tree

Given a binary tree, write an efficient algorithm to compute maximum width of it.

## Build Binary Tree from given Parent array

Given an array A which represents a binary tree such that the parent-child relationship is defined by (A[i], i) for every index i in the array A, build binary tree out of it. The value of root node will be i if -1 is present at index i in the array. It may be assumed …

## Invert Binary Tree | Recursive and Iterative solution

Given a binary tree, write an efficient algorithm to invert binary tree.

## Convert normal binary tree to Left-child right-sibling binary tree

Given a normal binary tree, convert it to Left-child right-sibling (LC-RS) binary tree.

## Construct a Binary Tree from Ancestor Matrix

Given an ancestor matrix, whose cell (i, j) has value true if i is ancestor of j in a binary tree, construct a binary tree from it where binary tree nodes are labelled from 0 to n-1 where n is the size of the ancestor matrix.