## Next Larger element in n-ary tree

Given a generic tree and a integer x. Find and return the node with next larger element in the tree i.e. find a node just… Read More »

- Number of special nodes in an n-ary tree
- Preorder Traversal of N-ary Tree Without Recursion
- Level with maximum number of nodes using DFS in a N-ary tree
- Determine the count of Leaf nodes in an N-ary tree
- Print all the levels with odd and even number of nodes in it | Set-2
- DP on Trees | Set-3 ( Diameter of N-ary Tree )
- Number of leaf nodes in the subtree of every node of an n-ary tree
- Print levels with odd number of nodes and even number of nodes

Given a generic tree and a integer x. Find and return the node with next larger element in the tree i.e. find a node just… Read More »

Given an N-ary tree, find and return the node with second largest value in the given tree. Return NULL if no node with required value… Read More »

Given an N-Ary tree, find and return the node for which sum of data of all children and the node itself is maximum. In the… Read More »

Given a N-ary tree represented as adjacency list, we need to write a program to count all such nodes in this tree which has more… Read More »

Given a generic tree, perform a Level order traversal and print all of its nodes Input : 10 / / \ \ 2 34 56… Read More »

A tree consisting of n nodes is given, we need to print its DFS. Examples : Input : Edges of graph 1 2 1 3… Read More »

Given a parent array P, where P[i] indicates the parent of ith node in the tree(assume parent of root node id indicated with -1). Find… Read More »

Given an array which contains the preorder traversal of full k-ary tree, construct the full k-ary tree and print its postorder traversal. A full k-ary… Read More »

Given two n-ary trees, the task is to check if they are mirror of each other or not. Print “Yes” if they are mirror of… Read More »

Left-Child Right-Sibling Representation is a different representation of an n-ary tree where instead of holding a reference to each and every child node, a node… Read More »

An n-ary tree in computer science is a collection of nodes normally represented hierarchically in the following fashion. The tree starts at the root node.… Read More »

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 »

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 »

The diameter of an N-ary tree is the longest path present between any two nodes of the tree. These two nodes must be two leaf… Read More »

Given an N-Ary tree, find depth of the tree. An N-Ary tree is a tree in which nodes can have at most N children. Examples:… Read More »