##
Closest leaf to a given node in Binary Tree
January 24, 2016

Given a Binary Tree and a node x in it, find distance of the closest leaf to x in Binary Tree. If given node itself… Read More »

January 24, 2016

Given a Binary Tree and a node x in it, find distance of the closest leaf to x in Binary Tree. If given node itself… Read More »

January 6, 2016

Given an n-ary tree of resources arranged hierarchically such that height of tree is O(Log N) where N is total number of nodes (or resources).… Read More »

December 21, 2015

Given an array that represents Inorder Traversal, find all possible Binary Trees with the given Inorder traversal and print their preorder traversals.

December 15, 2015

The article describes an approach to solving the problem of finding the LCA of two nodes in a tree by reducing it to a RMQ… Read More »

December 11, 2015

Given a Binary Tree, return following value for it. 1) For every level, compute sum of all leaves if there are leaves at this level.… Read More »

December 8, 2015

A Binary Tree is labeled if every node is assigned a label and a Binary Tree is unlabeled if nodes are not assigned any label.… Read More »

November 10, 2015

Given a binary tree, write a program to count the number of Single Valued Subtrees. A Single Valued Subtree is one in which all the… Read More »

October 30, 2015

Given an array of numbers, return true if given array can represent preorder traversal of a Binary Search Tree, else return false. Expected time complexity… Read More »

October 26, 2015

Given a Tree where every node contains variable number of children, convert the tree to its mirror. Below diagram shows an example. We strongly recommend… Read More »

October 25, 2015

A succinct encoding of Binary Tree takes close to minimum possible space. The number of structurally different binary trees on n nodes is n’th Catalan… Read More »

October 16, 2015

Given an array that represents a tree in such a way that array indexes are values in tree nodes and array values give the parent… Read More »

October 13, 2015

Given a binary tree, check whether it is a mirror of itself. For example, this binary tree is symmetric: 1 / \ 2 2 /… Read More »

October 12, 2015

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from root node down to… Read More »

August 21, 2015

Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Example: Input: Root of… Read More »

August 13, 2015

Expression tree is a binary tree in which each internal node corresponds to operator and each leaf node corresponds to operand so for example expression… Read More »