Tag Archives: DFS

Given a tree consisting of N nodes numbered from [1, N] and is colored either black(denoted by 1) or green(denoted by 0), the task is… Read More
Given a binary valued undirected graph with V vertices and E edges, the task is to find the hexadecimal equivalents of all the connected components… 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 a N-ary tree with some colour associated with every node and Q queries. Each query contains two integers A and X. The task is… Read More
Given a directed graph containing N vertices and M edges, the task is to find all the dependencies of each vertex in the graph and… Read More
Given a binary valued undirected graph with V vertices and E edges, the task is to find the octal equivalents of all the connected components… Read More
A mother vertex in a Graph G = (V, E) is a vertex v such that a path from v can reach all other vertices… Read More
Given a N-ary Tree and Q queries where each query contains a node of the N-ary tree, the task is to count the number of… 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 a tree of N nodes, the task is to find the node having maximum depth starting from the root node, taking the root node… Read More
Parenthesis Theorem is used in DFS of graph. It states that the descendants in a depth-first-search tree have an interesting property. If v is a… Read More
Given an undirected graph with V vertices and E edges, the task is to find the maximum contiguous subarray sum among all the connected components… Read More
Given an array A containing N integers, the task is to count the number of elements which form a cycle in the array, based on… Read More
Given an undirected acyclic graph having N nodes and M edges, the task is to find the size of the largest tree in the forest… Read More