Given an N-array Tree consisting of N nodes and an integer K, the task is to find the Kth largest element in the given N-ary… Read More

# Tag Archives: DFS

Given an array of pairs Edges[][], representing edges connecting vertices in a Tree consisting of N nodes, the task is to find the minimum time… Read More

Given a Directed Acyclic Graph with V vertices and E edges, the task is to find the set of dominant vertices for each vertex of… Read More

Given a Binary Tree consisting of N nodes, the task is to replace each node of the tree with the product of all the remaining… Read More

Given a Binary Tree consisting of N nodes, the task is to find the minimum number of cameras required to monitor the entire tree such… Read More

Given a Binary Tree consisting of N nodes having distinct values from the range [1, N], the task is to find the lowest common ancestor… Read More

Given an undirected weighted graph G consisting of N vertices and M edges, and two arrays Edges[][2] and Weight[] consisting of M edges of the… Read More

Given two graphs G1 and G2, the task is to find the union and intersection of the two given graphs, i.e. (G1 ∪ G2) and… Read More

Given a Binary Tree consisting of N nodes, the task is to find the number of paths from the root to any node X, such… Read More

Given a weighted graph consisting of N nodes and M edges, a source vertex, a destination vertex, and an integer K, the task is to… Read More

Given a binary matrix mat[][] that represents the adjacency matrix representation of a graph, where mat[i][j] as 1 represents that there is an edge between… Read More

Given a 2D array Edges[][], representing a directed edge between the pair of nodes in a Directed Acyclic Connected Graph consisting of N nodes valued… Read More

Given a 2D array grid[][] of dimension N * M, the task is to perform the Depth – First Search traversal on the given 2D… Read More

Given an N-ary tree consisting of N nodes having values 0 to (N – 1), the task is to find the total number of subtrees… Read More

Given a Binary Tree consisting of N nodes, valued from 1 to N, rooted at node 1, the task is for each node is to… Read More