## Implementation of DFS using adjacency matrix

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 »

- Difference Between BFS and DFS
- Print all neighbour nodes within distance K
- Minimum number of pairs required to make two strings same
- Sum of the distances from every node to all other nodes is maximum
- Maximum number of nodes which can be reached from each node in a graph.
- Find K vertices in the graph which are connected to at least one of remaining vertices
- Print all leaf nodes of an n-ary tree using DFS
- Count the nodes of the given tree whose weighted string is a palindrome
- Count the nodes of the tree which make a pangram when concatenated with the sub-tree nodes
- Count the nodes of the given tree whose weight has X as a factor
- Count the nodes in the given tree whose weight is even parity
- Construct the Rooted tree by using start and finish time of its DFS traversal
- Find the node whose sum with X has minimum set bits
- Count the nodes whose sum with X is a Fibonacci number
- Implementation of DFS using adjacency matrix
- Find the root of the sub-tree whose weighted sum XOR with X is maximum
- Find the node whose sum with X has maximum set bits
- Count the nodes of a tree whose weighted string is an anagram of the given string
- Count the nodes whose weight is a perfect square
- Count the nodes of a tree whose weighted string does not contain any duplicate characters
- Queries for the number of nodes having values less than V in the subtree of a Node
- Count the nodes of the tree whose weighted string contains a vowel
- Find the node whose absolute difference with X gives maximum value
- Find the node whose absolute difference with X gives minimum value

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 »

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 »