##
Sum of nodes at k-th level in a tree represented as string
May 5, 2017

Given an integer ‘K’ and a binary tree in string format. Every node of a tree has value in range from 0 to 9. We… Read More »

May 5, 2017

Given an integer ‘K’ and a binary tree in string format. Every node of a tree has value in range from 0 to 9. We… Read More »

April 26, 2017

Given two binary trees, find first leaves of two trees that do not match. If there are no non-matching leaves, print nothing. Examples: Input :… Read More »

April 16, 2017

What is Prufer Code? Given a tree (represented as graph, not as a rooted tree) with n labeled nodes with labels from 1 to n,… Read More »

April 13, 2017

Given A binary Tree, how do you count all the half nodes (which has only one child) without using recursion? Note leaves should not be… Read More »

April 11, 2017

Given a binary tree, count leaves in the tree without using recursion. A node is a leaf node if both left and right children of… Read More »

April 2, 2017

Given a binary tree, print all nodes will are full nodes. Full Nodes are nodes which has both left and right children as non-empty. Examples:… Read More »

March 27, 2017

BK Tree or Burkhard Keller Tree is a data structure that is used to perform spell check based on Edit Distance (Levenshtein distance) concept. BK… Read More »

March 26, 2017

We encounter various problems like Maximum length palindrome in a string, number of palindromic substrings and many more interesting problems on palindromic substrings . Mostly… Read More »

March 25, 2017

Given a binary tree, find the deepest node in it. Examples: Input : Root of below tree 1 / \ 2 3 / \ /… Read More »

March 20, 2017

Given an undirected tree which has even number of vertices, we need to remove the maximum number of edges from this tree such that each… Read More »

March 11, 2017

Given a binary tree, print the root to the leaf path, but add “_” to indicate the relative position. Example: Input : Root of below… Read More »

March 6, 2017

Given a Binary Tree, check whether the Binary tree contains a duplicate sub-tree of size 2 or more. Note : Two same leaf nodes are… Read More »

March 5, 2017

Given an undirected tree, we need to find the longest path of this tree where a path is defined as a sequence of nodes. Example:… Read More »

February 23, 2017

We have seen various methods with different Time Complexities to calculate LCA in n-ary tree:- Method 1 : Naive Method ( by calculating root to… Read More »

February 14, 2017

Idea of Threaded Binary Tree is to make inorder traversal faster and do it without stack and without recursion.