## Kth ancestor of a node in an N-ary tree using Binary Lifting Technique

Given a vertex V of an N-ary tree and an integer K, the task is to print the Kth ancestor of the given vertex in… Read More »

## Check if the level order traversal of a Binary Tree results in a palindrome

Given a binary tree and the task if to check if it’s level order traversal results in a palindrome or not. Examples: Input: Output: Yes… Read More »

## Finding the lexicographically smallest diameter in a binary tree

Given a binary tree where node values are lowercase alphabets, the task is to find the lexicographically smallest diameter. A diameter is the longest path… Read More »

## Iterative Postorder Traversal of N-ary Tree

Given an N-ary tree, the task is to find the post-order traversal of the given tree iteratively. Examples: Input: 1 / | \ 3 2… Read More »

## Check if a Binary Tree is BST : Simple and Efficient Approach

Given a Binary Tree, the task is to check whether the given binary tree is Binary Search Tree or not. A binary search tree (BST)… Read More »

## Left-Right traversal of all the levels of N-ary tree

Given a Complete Binary Tree rooted at node 1, the task is to print the elements in the following defined order. First, print all elements… Read More »

## Check if value exists in level-order sorted complete binary tree

Given a level-order sorted complete binary tree, the task is to check whether a key exists in it or not. A complete binary tree has… Read More »

## Bottom View of a Binary Tree using Recursion

Given a binary tree, the task is to find the bottom view of a binary tree using recursion. Examples: Input: 1 \ 2 \ 4… Read More »

## Find count of pair of nodes at even distance

Given a connected acyclic graph with N nodes and N-1 edges, find out the pair of nodes that are at even distance from each other.… Read More »

## Create a binary tree from post order traversal and leaf node array

Given 2 arrays, the first one containing postorder traversal sequence and the second one containing the information whether the corresponding node in the first array… Read More »

## Find distance of nodes from root in a tree for multiple queries

Given a tree with N vertices numbered from 0 to N – 1 and Q queries containing nodes in the tree, the task is to… Read More »

## Find parent of each node in a tree for multiple queries

Given a tree with N vertices numbered from 0 to N – 1 and Q query containing nodes in the tree, the task is to… Read More »

## Find the parent of a node in the given binary tree

Given a tree and a node, the task is to find the parent of the given node in the tree. Print -1 if the given… Read More »

## Check whether a node is leaf node or not for multiple queries

Given a tree with N vertices numbered from 0 to N – 1 where 0 is the root node. The task is to check if… Read More »

## Diameter of a Binary Indexed Tree with N nodes

Given a Binary Indexed Tree with N nodes except root node 0 (Numbered from 1 to N), Find its diameter. Binary Indexed Tree is a… Read More »