Construct the Rooted tree by using start and finish time of its DFS traversal

Given start and finish times of DFS traversal of N vertices that are available in a Rooted tree, the task is to construct the tree… Read More »

Convert a given Binary Tree to Circular Doubly Linked List | Set 2

Given a Binary Tree, convert it to a Circular Doubly Linked List. The left and right pointers in nodes are to be used as previous… Read More »

Density of Binary Tree using Level Order Traversal

Given a Binary Tree, find the density of it by doing one traversal of it. The density of binary tree is defined as: Density of… Read More »

Print all the nodes except the leftmost node in every level of the given binary tree

Given a binary tree, the task is to print all the nodes except the leftmost in every level of the tree. The root is considered… Read More »

Number of trees whose sum of degrees of all the vertices is L

Given an integer L which is the sum of degrees of all the vertices of some tree. The task is to find the count of… Read More »

Count the nodes of the tree which make a pangram when concatenated with the sub-tree nodes

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 »

Number of ways to paint a tree of N nodes with K distinct colors with given conditions

Given a tree with N nodes and a number K. Paint every node of the tree in one of the K available colors. Count and… Read More »

Check if the given Prufer sequence is valid or not

Given a Prufer sequence of N integers, the task is to check if the given sequence is a valid Prufer sequence or not. Examples: Input:… Read More »

Count the nodes of a tree whose weighted string is an anagram of the given string

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 »

Count the nodes of a tree whose weighted string does not contain any duplicate characters

Given a tree, and the weights (in the form of strings) of all the nodes, the task is to count the nodes whose weights does… Read More »

Print the degree of every node from the given Prufer sequence

Given a Prufer sequence, the task is to find the degrees of all the nodes of the tree made by the prufer sequence. Examples: Input:… Read More »

Print the node with the maximum degree in the prufer sequence

Given a Prufer sequence of a Tree, the task is to print the node with the maximum degree in the tree whose Prufer sequence is… Read More »

Count the nodes of the given tree whose weight has X as a factor

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 »

Count the nodes of the given tree whose weighted string is a palindrome

Given a tree, and the weights (in the form of strings) of all the nodes, the task is to count the nodes whose weights are… Read More »

Count the nodes of the tree whose weighted string contains a vowel

Given a tree, and the weights (in the form of strings) of all the nodes, the task is to count the nodes whose weights contain… Read More »