Skip to content

Tag Archives: Trees

Given a tree with the weights of all the nodes, the task is to count the number of nodes whose weight is a Fibonacci number.Examples:  … Read More
Given a binary tree with N nodes and an integer K, the task is to print nodes of the Kth level of a binary tree… Read More
Given a binary tree, the task is to find the sum of all the nodes whose parent is even.Examples:   Input: 1 / \ 3 8… Read More
Given a graph of N nodes, E edges, a node X and a distance K. The task is to print all the nodes within the… Read More
Given a rooted tree (assume root is 1) of N nodes and Q queries, each of the form (Val, Node). For each query, the task… Read More
Given a tree, and the weights (in the form of strings) of all the nodes, the task is to count the nodes whose weighted string… Read More
Given a tree, and the weights (in the form of strings) of all the nodes, the task is to count the nodes whose weighted string… Read More
Given a tree, and the weights of all the nodes, the task is to count the number of nodes whose sum of digits of weights… 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 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 find the root of the sub-tree whose weighted sum is minimum.… Read More
Given a tree, and the weights of all the nodes, the task is to find the root of the sub-tree whose weighted sum XOR with… Read More
Given a tree, and the weights of all the nodes, the task is to count the number of nodes whose weight is even.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
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