##
Diameter of an N-ary tree
January 27, 2017

The diameter of an N-ary tree is the longest path present between any two nodes of the tree. These two nodes must be two leaf… Read More »

January 27, 2017

The diameter of an N-ary tree is the longest path present between any two nodes of the tree. These two nodes must be two leaf… Read More »

January 25, 2017

Given an N-Ary tree, find depth of the tree. An N-Ary tree is a tree in which nodes can have at most N children. Examples:… Read More »

January 21, 2017

Given a Binary tree and a sum S, print all the paths, starting from root, that sums upto the given sum. Note that this problem… Read More »

January 19, 2017

In previous posts, we have discussed how to calculate the Lowest Common Ancestor (LCA) for a binary tree and a binary search tree (this, this… Read More »

January 17, 2017

Given a Binary tree, find out depth of the deepest odd level leaf node. Take root level as depth 1. Examples: Input : Output :… Read More »

January 15, 2017

Given preorder of a binary tree, calculate its depth(or height) [starting from depth 0]. The preorder is given as a string with two possible characters.… Read More »

December 31, 2016

Given an array of n integers, each integer is greater than 1. The task is to find the number of Full binary tree from the… Read More »

December 23, 2016

You are given a binary tree and a given sum. The task is to check if there exist a subtree whose sum of all nodes… Read More »

December 22, 2016

Given a binary tree and a integer value K, the task is to find all nodes in given binary tree having K leaves in subtree… Read More »

December 14, 2016

Given a binary tree with a value associated with each node, we need to choose a subset of these nodes such that sum of chosen… Read More »

December 12, 2016

Given a Binary Tree having positive and negative nodes, the task is to find maximum sum level in it. Examples: Input : 4 / \… Read More »

December 11, 2016

Given a binary tree, print the number of root to leaf paths having equal lengths. Examples: Input : Root of below tree 10 / \… Read More »

December 10, 2016

A tree is Continuous tree if in each root to leaf path, absolute difference between keys of two adjacent is 1. We are given a… Read More »

December 7, 2016

Given a binary tree, find if there is a pair in root to a leaf path such that sum of values in pair is equal… Read More »

November 30, 2016

Given a binary tree and an array, the task is to find if the given array sequence is present as a root to leaf path… Read More »