## Sum of the distances from every node to all other nodes is maximum

Given a tree with N nodes and N-1 edges with root at 1 and given an array of N-1 integers. The task is to assign… Read More »

- Longest path in a directed Acyclic graph | Dynamic Programming
- Number of special nodes in an n-ary tree
- DP on Trees | Set-3 ( Diameter of N-ary Tree )
- Unique paths covering every non-obstacle block exactly once in a grid
- Minimum number of edges between two vertices of a graph using DFS
- Count the number of nodes at a given level in a tree using DFS
- Program to count Number of connected components in an undirected graph
- Minimum number of pairs required to make two strings same
- Minimum steps to color the tree with given colors
- Minimum edges to be added in a directed graph so that any node can be reachable from a given node
- Check if a directed graph is connected or not
- Difference Between BFS and DFS
- Maximum number of nodes which can be reached from each node in a graph.
- Number of connected components in a 2-D matrix of strings
- Count the nodes of the given tree whose weighted string is a palindrome
- Print the lexicographically smallest DFS of the graph starting from 1
- Find the node whose xor with x gives minimum value
- Find the Kth node in the DFS traversal of a given subtree in a Tree
- Find the maximum value permutation of a graph
- Print all leaf nodes of an n-ary tree using DFS
- Find number of edges that can be broken in a tree such that Bitwise OR of resulting two trees are equal
- Number of unique paths in tree such that every path has a value greater than K
- Find K vertices in the graph which are connected to at least one of remaining vertices
- Count the nodes of the tree which make a pangram when concatenated with the sub-tree nodes
- Find the node whose sum with X has minimum set bits
- GCD from root to leaf path in an N-ary tree
- Count the nodes of the given tree whose weight has X as a factor
- Find the node whose xor with x gives maximum value
- Even size subtree in n-ary tree
- Construct the Rooted tree by using start and finish time of its DFS traversal

Given a tree with N nodes and N-1 edges with root at 1 and given an array of N-1 integers. The task is to assign… Read More »

Given a connected graph with N vertices. The task is to select k(k must be less than or equals to n/2, not necessarily minimum) vertices… Read More »

Given a graph with N nodes and K bidirectional edges between them find the number of nodes which can be reachable from a particular. Two… Read More »

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 »

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 weights does… 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:… 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 weights are… 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 weights contain… Read More »

Breadth First Search BFS stands for Breadth First Search is a vertex based technique for finding a shortest path in graph. It uses a Queue… 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 two strings s1 and s2 of same length, the task is to count the minimum number of pairs of characters (c1, c2) such that… 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 »