## Generic Trees(N-array Trees)

The Generic trees are the n-ary trees which have the following properties: Many children at every node. The number of nodes for each node is… Read More »

- Number of special nodes in an n-ary tree
- DP on Trees | Set-3 ( Diameter of N-ary Tree )
- Determine the count of Leaf nodes in an N-ary tree
- Print all leaf nodes of an n-ary tree using DFS
- GCD from root to leaf path in an N-ary tree
- Count the nodes of the given tree whose weight has X as a factor
- Find the node whose sum with X has maximum set bits
- Count the nodes in the given tree whose weight is even parity
- Count the nodes whose weight is a perfect square
- Generic Trees(N-array Trees)
- Count the nodes in the given tree whose weight is prime
- Find the node whose absolute difference with X gives maximum value
- Count the nodes in the given tree whose weight is a power of two

The Generic trees are the n-ary trees which have the following properties: Many children at every node. The number of nodes for each node is… Read More »

Given a tree, and the weights of all the nodes, the task is to count the nodes whose weights are divisible by x. Examples: Input:… Read More »

Given a tree and the weights of all the nodes, the task is to count the number of nodes whose weights are even parity i.e.… Read More »

Given an array edge[][2] where (edge[i][0], edge[i][1]) defines an edge in the n-ary tree, the task is to print all the leaf nodes of the… Read More »

Given a tree, and the weights of all the nodes, the task is to count the number of nodes whose weight is a power of… Read More »

Given a tree, and the weights of all the nodes, the task is to count the number of nodes whose weight is prime. Examples: Input:… Read More »

Given a tree, and the weights of all the nodes, the task is to count the number of nodes whose weight is a perfect Square.… Read More »

Given a tree, and the weights of all the nodes and an integer x, the task is to find a node i such that weight[i]… Read More »

Given a tree, and the weights of all the nodes and an integer x, the task is to find a node i such that |weight[i]… Read More »

Given an N-ary tree and an array val[] which stores the values associated with all the nodes. Also given are a leaf node X and… Read More »

Given an n-ary tree rooted at vertex 1. The tree has n vertices and n-1 edges. Each node has a value associated with it and… Read More »

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 »

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 »

Given a N-ary tree, the task is to print the level with the maximum number of nodes. Examples: Input : For example, consider the following… Read More »

Given an N-ary tree, print all the levels with odd and even number of nodes in it. Examples: For example consider the following tree 1… Read More »