# Category Archives: Trees

## Extract Leaves of a Binary Tree in a Doubly Linked ListOctober 4, 2013

Given a Binary Tree, extract all leaves of it in a Doubly Linked List (DLL).

## Remove all nodes which don’t lie in any path with sum>= kSeptember 24, 2013

Given a binary tree, a complete path is defined as a path from root to a leaf. The sum of all nodes on that path… Read More »

## Print Left View of a Binary TreeAugust 30, 2013

Given a Binary Tree, print left view of it. Left view of a Binary Tree is set of nodes visible when tree is visited from… Read More »

## Check if all leaves are at same levelAugust 27, 2013

Given a Binary Tree, check if all leaves are at same level or not.

## Find depth of the deepest odd level leaf nodeAugust 24, 2013

Write a C code to get the depth of the deepest odd level leaf node in a binary tree. Consider that level starts with 1.

## Print Postorder traversal from given Inorder and Preorder traversalsAugust 22, 2013

Given Inorder and Preorder traversals of a binary tree, print Postorder traversal.

## Difference between sums of odd level and even level nodes of a Binary TreeAugust 19, 2013

Given a a Binary Tree, find the difference between the sum of nodes at odd level and the sum of nodes at even level. Consider… Read More »

## Convert a given Binary Tree to Doubly Linked List | Set 2June 29, 2013

Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL). The left and right pointers in nodes are to be used as previous… Read More »

## Custom Tree ProblemJune 18, 2013

You are given a set of links, e.g. a —> b b —> c b —> d a —> e Print the tree that would… Read More »

## Iterative Method to find Height of Binary TreeJune 4, 2013

There are two conventions to define height of Binary Tree 1) Number of nodes on longest path from root to the deepest node. 2) Number… Read More »

## Tree Isomorphism ProblemMay 15, 2013

Write a function to detect if two trees are isomorphic. Two trees are called isomorphic if one of them can be obtained from other by… Read More »

## Convert a given Binary Tree to Doubly Linked List | Set 1April 1, 2013

Given a Binary Tree (Bt), convert it to a Doubly Linked List(DLL). The left and right pointers in nodes are to be used as previous… Read More »

## Binary Tree | Set 1 (Introduction)March 31, 2013

Trees: Unlike Arrays, Linked Lists, Stack and queues, which are linear data structures, trees are hierarchical data structures.

## Construct Complete Binary Tree from its Linked List RepresentationMarch 19, 2013

Given Linked List Representation of Complete Binary Tree, construct the Binary tree. A complete binary tree can be represented in an array in the following… Read More »

## Reverse Level Order TraversalMarch 11, 2013

We have discussed level order traversal of a post in previous post. The idea is to print last level first, then second last level, and… Read More »