## Check whether the cost of going from any node to any other node via all possible paths is same

Given adjacency list representation of a directed graph, the task is to check whether the cost of going from any vertex to any other vertex… Read More »

- Count total ways to reach destination from source in an undirected Graph
- Paranthesis Theorem
- Count nodes in the given tree whose weight is a fibonacci number
- Find a Mother vertex in a Graph using Bit Masking
- Minimum time required to visit all the special nodes of a Tree
- Count of distinct colors in a subtree of a Colored Tree with given min frequency for Q queries
- Count of different groups using Graph
- Count of elements which form a loop in an Array according to given constraints
- Minimum Cost of Simple Path between two nodes in a Directed and Weighted Graph
- Lowest Common Ancestor for a Set of Nodes in a Rooted Tree
- Minimum labelled node to be removed from undirected Graph such that there is no cycle
- Find dependencies of each Vertex in a Directed Graph
- Find GCD of each subtree of a given node in an N-ary Tree for Q queries
- Maximum weighted edge in path between two nodes in an N-ary tree using binary lifting
- Largest subarray sum of all connected components in undirected graph
- Count the nodes in the given Tree whose weight is a Perfect Number
- Largest component size in a graph formed by connecting non-co-prime nodes
- Minimum Bipartite Groups
- Count of unique lengths of connected components for an undirected graph using STL
- Count of nodes having odd divisors in the given subtree for Q queries
- Minimum value of distance of farthest node in a Graph
- Find the maximum component size after addition of each edge to the graph
- Count ways to change direction of edges such that graph becomes acyclic
- Count the number of walks of length N where cost of each walk is equal to a given number
- Minimum valued node having maximum depth in an N-ary Tree
- Size of the Largest Trees in a Forest formed by the given Graph
- Octal equivalents of connected components in Binary valued graph
- Minimum string such that every adjacent character of given string is still adjacent
- Count of leaf nodes of the tree whose weighted string is a palindrome
- Print the nodes of the Binary Tree whose height is a Prime number

Given adjacency list representation of a directed graph, the task is to check whether the cost of going from any vertex to any other vertex… Read More »

Given a graph with N nodes having values either P or M. Also given K pairs of integers as (x, y) representing the edges in… Read More »

Given an ancestor matrix mat[n][n] where the ancestor matrix is defined as below. mat[i][j] = 1 if i is ancestor of j mat[i][j] = 0,… Read More »

Given a 2D array of characters with M rows and N columns. The task is to print all the possible paths from top (first row)… Read More »

Given a connected acyclic graph with N nodes and N-1 edges, find out the pair of nodes that are at even distance from each other.… Read More »

Given N dependencies of the form X Y, where X & Y represents two different tasks. The dependency X Y denotes dependency of the form… Read More »

Depth First Search (DFS) has been discussed in this article which uses adjacency list for the graph representation. In this article, adjacency matrix will be… 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 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 »