# Category Archives: Tree

AucFind the distance between two keys in a binary tree, no parent pointers are given. The distance between two nodes is the minimum number of… Read More
What is Lowest Common Ancestor in Binary Tree? The lowest common ancestor is the lowest node in the tree that has both n1 and n2… Read More
Given a Binary Tree, print all nodes that don’t have a sibling (a sibling is a node that has same parent. In a Binary Tree,… Read More
Given a Binary Tree, The task is to convert it to a Doubly Linked List keeping the same order.  The left and right pointers in… Read More
Given a binary tree, where every node value is a Digit from 1-9. Find the sum of all the numbers which are formed from root… Read More
Given a Binary tree and a key in the binary tree, find the node right to the given key. If there is no node on… Read More
Given a Binary Tree, find the deepest leaf node that is left child of its parent. For example, consider the following tree. The deepest left… Read More
Given a Binary Tree, extract all leaves of it in a Doubly Linked List (DLL). Note that the DLL need to be created in-place. Assume… Read More
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
Given a Binary Search Tree (BST), modify it so that all greater values in the given BST are added to every node. For example, consider… Read More
Given a Binary Tree, the task is to print the left view of the Binary Tree. The left view of a Binary Tree is a… Read More
Given a Binary Tree, check if all leaves are at same level or not.  12 / \ 5 7 / \ 3 1 Leaves are… Read More
Write a code to get the depth of the deepest odd level leaf node in a binary tree. Consider that level starts with 1. Depth… Read More
AuxiliaryGiven Inorder and Preorder traversals of a binary tree, print Postorder traversal. Example: Input: Inorder traversal in[] = {4, 2, 5, 1, 3, 6} Preorder… Read More
Given a Binary Tree, find the difference between the sum of nodes at odd level and the sum of nodes at even level. Consider root… Read More