Skip to content

Tag Archives: BFS

Given a graph, G consisting of N nodes, a source S, and an array Edges[][2] of type {u, v} that denotes that there is an… Read More
Generating Random Unweighted Binary Tree: Since this is a tree, the test data generation plan is such that no cycle gets formed. The number of… Read More
Given an unweighted graph and a boolean array A[ ], where if the ith index of array A[ ] denotes if that node can can… Read More
Given a matrix mat][][] of size M x N which represents the topographic map of a region, and 0 denotes land and 1 denotes elevation,… 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 matrix arr[][], consisting of only 0, 1, and 2, that represents an empty ward, an uninfected patient, and an infected patient respectively. In… Read More
Given a matrix grid[][] of dimensions M * N, three integers X, Y, and K, the task is to check if there exists any path… Read More
Given a directed weighted graph consisting of N vertices and an array Edges[][], with each row representing two vertices connected by an edge and the… Read More
Given an integer N, representing the number of stairs, valued from 1 to N, and a starting position S, the task is to count the… Read More
Given a binary matrix mat[][] of dimensions of N * M and pairs of integers src and dest representing source and destination cells respectively, the… Read More
Given an array arr[][] consisting of N segments of the form {L, R, V} where, [L, R] denotes a segment with velocity V in any… Read More
Given an integer N, representing the number of nodes present in an undirected graph, with each node valued from 1 to N, and a 2D… Read More
Given a 2D array arr[][] of dimensions N*M, representing a minesweeper matrix, where each cell contains an integer from the range [0, 9], representing the… Read More
Given an integer N denoting the number of connected cities ( numbered from 1 to N ) and a 2D array arr[][] consisting of pairs… Read More
Given a grid mat[][] of size M * N, consisting of only 0s, 1s, and 2s, where 0 represents empty place, 1 represents a person… Read More