Skip to content

Tag Archives: n-ary-tree

Given a N ary Tree consisting of N nodes, the task is to find the minimum distance from node A to node B of the… Read More
Given a generic tree consisting of N nodes and (N – 1) edges and an array of queries query[] of size Q consisting of the… Read More
Given a generic tree consisting of N nodes, the task is to find the maximum sum of the path from the root to the leaf… Read More
Given an N-ary Tree consisting of N nodes valued from [0, N – 1] and two binary arrays initial[] and final[] of size N such… Read More
Given an N-array Tree (Generic Tree) and an integer K, the task is to find the Kth smallest element in an N-array Tree. Examples: Input:… Read More
Given an N-array Tree consisting of N nodes and an integer K, the task is to find the Kth largest element in the given N-ary… Read More
Given an array of pairs Edges[][], representing edges connecting vertices in a Tree consisting of N nodes, the task is to find the minimum time… Read More
Given an N-ary tree consisting of N nodes, the task is to find the node having the largest value in the given N-ary Tree. Examples:… Read More
Given an N-ary tree consisting of N nodes having values 0 to (N – 1), the task is to find the total number of subtrees… Read More
Given an N-Ary tree, the task is to print all root to leaf paths of the given N-ary Tree. Examples: Input:         … Read More
Given an array weights[] consisting of N positive integer, where weights[i] denotes the weight of ith node, the task is to construct an N-ary tree… Read More
Given an N-ary tree and an element X, the task is to print the siblings of the node with value X. Two nodes are considered… Read More
Given an N-array tree of N nodes, rooted at 1, with edges in the form {u, v}, and an array values[] consisting of N integers.… Read More
Prerequisite: Generic Trees(N-array Trees)  In this article, we will discuss the conversion of the Generic Tree to a Binary Tree. Following are the rules to… Read More
Given a N-ary Tree consisting of nodes valued in the range [0, N – 1] and an array arr[] where each node i is associated… Read More

Start Your Coding Journey Now!