## Reverse Level Order traversal in spiral form

Given a binary tree, the task is to print the reverse level order in spiral form. Examples: Input: 1 / \ 2 3 / \… Read More »

## Find the number of distinct pairs of vertices which have a distance of exactly k in a tree

Given an integer k and a tree with n nodes. The task is to count the number of distinct pairs of vertices which have a… Read More »

## Print All Leaf Nodes of a Binary Tree from left to right | Set-2 ( Iterative Approach )

Given a Binary Tree, the task is to print the leaf nodes from left to right. The nodes must be printed in the order they… Read More »

## Make a tree with n vertices , d diameter and at most vertex degree k

Given three integers N, D and K. The task is to check whether it is possible to make a tree with exactly N vertices, D… Read More »

## Zig-Zag traversal of a Binary Tree using Recursion

Given a Binary Tree, the task is to print the zigzag order of the tree. Examples: Input : 7 / \ 6 5 / /… Read More »

## Remove all multiples of K from Binary Tree

Given a binary tree and an integer K, the task is to remove all the nodes which are multiples of K from the given binary… Read More »

## Print the first shortest root to leaf path in a Binary Tree

Given a Binary Tree with distinct values, the task is to print the first smallest root to leaf path. We basically need to print the… Read More »

## DP on Trees | Set-3 ( Diameter of N-ary Tree )

Given an N-ary tree T of N nodes, the task is to calculate the longest path between any two nodes(also known as the diameter of… Read More »

## Print all internal nodes of a Binary tree

Given a Binary tree, the task is to print all the internal nodes in a tree. An internal node is a node which carries at… Read More »

## Minimum number of groups of nodes such that no ancestor is present in the same group

Given a tree of N nodes. The task is to form the minimum number of groups of nodes such that every node belong to exactly… Read More »

## Reverse zigzag Traversal of a Binary Tree

Given a Binary Tree, the task is to print the Reverse zigzag Order of the tree. Examples: Input: 1 / \ 2 3 / \… Read More »

## Determine the count of Leaf nodes in an N-ary tree

Given the value of ‘N’ and ‘I’. Here, represents the number of internal nodes present in an N-ary tree and every node of the N-ary… Read More »

## Print Leaf Nodes at a given Level

Given a Binary tree, print all the leaf nodes of a Binary tree at a given level L. Examples: Input: 1 / \ 2 3… Read More »

## Maximize the sum of products of the degrees between any two vertices of the tree

Given an integer N, the task is to construct a tree such that sum of for all ordered pairs (u, v) is maximum where u… Read More »

## Distribute candies in a Binary Tree

Given a binary tree with N nodes, in which each node value represents number of candies present at that node, and there are N candies… Read More »