##
Connect nodes at same level
January 11, 2012

Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is… Read More »

January 11, 2012

Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is… Read More »

August 15, 2011

Given two binary trees, check if the first tree is subtree of the second one.

May 4, 2011

Write a function that returns true if the given Binary Tree is SumTree else false. A SumTree is a Binary Tree where the value of… Read More »

March 4, 2011

Minimum Spanning Tree (MST) problem: Given connected graph G with positive edge weights, find a min weight set of edges that connects all of the… Read More »

March 1, 2011

Given a Binary Tree and a key, write a function that prints all the ancestors of the key in the given binary tree.

February 27, 2011

Given a Binary Tree and a key, write a function that returns level of the key. For example, consider the following tree. If the input… Read More »

February 7, 2011

Difficulty Level: Rookie Why Tree? Unlike Array and Linked List, which are linear data structures, tree is hierarchical (or non-linear) data structure.

September 16, 2010

Given a root of a tree, and an integer k. Print all the nodes which are at k distance from root.

June 16, 2010

Question: Given a binary tree, find out if the tree can be folded or not. A tree can be folded if left and right subtrees… Read More »

May 15, 2010

Given a binary tree, write a function to get the maximum width of the given tree. Width of a tree is maximum of widths of… Read More »

April 30, 2010

Write a program that converts a given tree to its Double tree. To create Double tree of the given tree, create a new duplicate for… Read More »

April 18, 2010

For the below example tree, all root-to-leaf paths are:

April 16, 2010

Let us consider the below traversals: Inorder sequence: D B E A F C Preorder sequence: A B D E C F Recommended: Please solve… Read More »

April 7, 2010

Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the… Read More »

April 5, 2010

Using Morris Traversal, we can traverse the tree without using stack and recursion. The idea of Morris Traversal is based on Threaded Binary Tree.