Given an undirected graph having N vertices and M edges and each vertex is associated with a cost and a source vertex S is given.… Read More

# Tag Archives: DFS

Given a N-ary tree consisting of N nodes and a matrix edges[][] consisting of N – 1 edges of the form (X, Y) denoting the… Read More

Given a non-cyclic graph having V nodes and E edges and a source node S, the task is to calculate the sum of the minimum… Read More

Given a grid of size N*M consists of 0 and 1 only, the task is to find the length of longest connected 1s in the… Read More

Given an array arr[] of N positive integers and two positive integers S and K, the task is to reach the position of the array… Read More

Given two integer N and K, the task is to find the size of the smallest string that contains all permutations of length N that can… Read More

Given an array arr[] of N integers of value from 0 to N, the task is to count the number of components in Index Array. … Read More

Given an N-Ary tree containing N nodes and an array weight [ ] that denotes the weight of the nodes which can be positive or… Read More

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