Skip to content

Tag Archives: n-ary-tree

Prerequisite: Segment tree and depth first search.In this article, an approach to convert an N-ary rooted tree( a tree with more than 2 children) into… Read More
Given an N-ary tree containing, the task is to print the inorder traversal of the tree. Examples:  Input: N = 3   Output: 5 6 2… Read More
Given an N-ary tree, the task is to find the post-order traversal of the given tree iteratively.Examples:  Input: 1 / | \ 3 2 4… Read More
Given a Binary Tree rooted at node 1, the task is to print the elements in the following defined order.  First, print all elements of… Read More
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
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
Given a set of parent nodes where the index of the array is the child of each Node value, the task is to insert the… Read More
Given an n-ary tree, the task is to check whether the given tree is binary or not. Examples:  Input: A / \ B C /… Read More
Generic trees are a collection of nodes where each node is a data structure that consists of records and a list of references to its… 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:   x… 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:   Output:… 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.Examples:  … Read More

Start Your Coding Journey Now!