## Minimum edges to be added in a directed graph so that any node can be reachable from a given node

Given a directed graph and a node X. The task is to find the minimum number of edges that must be added to the graph… Read More »

- Print all the cycles in an undirected graph
- Find the number of distinct islands in a 2D matrix
- DFS traversal of a tree using recursion
- Tree, Back, Edge and Cross Edges in DFS of Graph
- Maximum number of edges among all connected components of an undirected graph
- Find the maximum node at a given level in a binary tree
- Find the ordering of tasks from given dependencies
- Sum of all odd nodes in the path connecting two given nodes
- Find whether it is possible to finish all tasks or not from given dependencies
- Find maximum path length in a binary matrix
- Unique paths covering every non-obstacle block exactly once in a grid
- Level with maximum number of nodes using DFS in a N-ary tree
- Minimum time to return array to its original state after given modifications
- Minimum number of edges between two vertices of a graph using DFS
- De Bruijn sequence | Set 1
- Lexicographically largest prime path from top-left to bottom-right in a matrix
- Find the probability of a state at a given time in a Markov chain | Set 1
- Perform the given queries on the rooted tree
- Printing pre and post visited times in DFS of a graph
- Count the number of nodes at a given level in a tree using DFS
- Print levels with odd number of nodes and even number of nodes
- Product of lengths of all cycles in an undirected graph
- Minimum edges to be added in a directed graph so that any node can be reachable from a given node
- Queries for DFS of a subtree in a tree
- DP on Trees | Set-3 ( Diameter of N-ary Tree )
- Queries for M-th node in the DFS of subtree
- Find the maximum value permutation of a graph
- Print the lexicographically smallest DFS of the graph starting from 1
- Number of unique paths in tree such that every path has a value greater than K
- Minimum number of groups of nodes such that no ancestor is present in the same group

Given a directed graph and a node X. The task is to find the minimum number of edges that must be added to the graph… Read More »

Given an N-ary tree T of N nodes, the task is to calculate the longest path between any two nodes(also known as the diameter of… Read More »

Given an integer l and a tree represented as an undirected graph rooted at vertex 0. The task is to print the number of nodes… Read More »

Given an undirected graph G(V, E) with N vertices and M edges. We need to find the minimum number of edges between a given pair… Read More »

Given a grid grid[][] with 4 types of blocks: 1 represents the starting block. There is exactly one starting block. 2 represents the ending block.… Read More »

Depth First Search (DFS) marks all the vertices of a graph as visited. So for making DFS useful, some additional information can also be stored.… Read More »

Given a N-ary tree, the task is to print the level with the maximum number of nodes. Examples: Input : For example, consider the following… Read More »

Given a binary tree and two nodes of that binary tree. Find the sum of all nodes with odd values in the path connecting the… Read More »

Given an N-ary tree, print all the levels with odd and even number of nodes in it. Examples: For example consider the following tree 1… Read More »

There are a total of n tasks you have to pick, labeled from 0 to n-1. Some tasks may have prerequisites, for example to pick… Read More »

There are a total of n tasks you have to pick, labeled from 0 to n-1. Some tasks may have prerequisites tasks, for example to… Read More »

Given an integer n and a set of characters A of size k, find a string S such that every possible string on A of… Read More »

Given two arrays of integers arr and P such that after a cycle an element arr[i] will be at location arr[P[i]]. The task is to… Read More »

Given a square matrix mat every element of which is either 0 or 1. A value 1 means connected and 0 means not connected. The… Read More »

Given integers ‘N’ and ‘K’ where, N is the number of vertices of an undirected graph and ‘K’ denotes the number of edges in the… Read More »