Skip to content

Tag Archives: n-ary-tree

Given an N-ary Tree consisting of nodes valued [1, N] and an array value[], where each node i is associated with value[i], the task is… Read More
Given an N-ary tree, the task is to find the maximum width of the given tree. The maximum width of a tree is the maximum… Read More
Given an N-ary tree and an integer K, the task is to print the Kth ancestors of all the nodes of the tree in level… Read More
Given an N-ary Tree rooted at 1, the task is to find the difference between the sum of nodes at the odd level and the… Read More
Given a N-ary tree with N vertices rooted at 1 and a set of vertices as V[], the task is to print any such vertex… Read More
Given an array arr[] representing a Generic(N-ary) tree. The task is to replace the node data with the depth(level) of the node. Assume level of… Read More
Given a Generic tree, the task is to delete the leaf nodes from the tree.  Examples: Input: 5 / / \ \ 1 2 3… Read More
Prerequisites:  Diameter of a N-ary tree Path between two nodes in a graph Given a N-ary tree with N nodes numbered from 0 to N-1… Read More
Given a N-ary tree consisting of N nodes and a matrix edges[][] consisting of N – 1 edges of the form (X, Y) denoting the… Read More
Given two N-ary trees having M nodes each. Also, given their edges and their roots respectively. The task is to check if they are isomorphic… Read More
Given an N-Ary tree containing N nodes and an array weight [ ] that denotes the weight of the nodes which can be positive or… Read More
Given a n-ary tree having nodes with a particular weight, our task is to find out the maximum sum of the minimum difference of divisors… Read More
Given an N-ary Tree containing N nodes, values associated with each node and Q queries, where each query contains a single node. The task is… Read More
Given an N-ary tree with weighted edge and Q queries where each query contains two nodes of the tree. The task is to find the… Read More
Given an N-ary tree, the task is to print the N-ary tree graphically.Graphical Representation of Tree: A representation of tree in which the root is… Read More

Start Your Coding Journey Now!