## Islands in a graph using BFS

Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5… Read More »

- Detect Cycle in a Directed Graph using BFS
- Dijkstra's shortest path with minimum edges
- Check if it is possible to reach a number by making jumps of two given length
- Maximum number of edges among all connected components of an undirected graph
- Difference between graph and tree
- Number of special nodes in an n-ary tree
- Jump Pointer Algorithm
- Graph Types and Applications
- Find the ordering of tasks from given dependencies
- Minimum steps required to convert X to Y where a binary matrix represents the possible conversions
- Shortest Path using Meet In The Middle
- Edge Coloring of a Graph
- Number of Walks from source to destination
- Longest path in a directed Acyclic graph | Dynamic Programming
- Find whether it is possible to finish all tasks or not from given dependencies
- Minimum number of edges between two vertices of a graph using DFS
- Unique paths covering every non-obstacle block exactly once in a grid
- Find maximum path length in a binary matrix
- Minimum spanning tree cost of given Graphs
- Finding the path from one vertex to rest using BFS
- Spanning Tree With Maximum Degree (Using Kruskal's Algorithm)
- Number of Isosceles triangles in a binary tree
- Cost of painting n * m grid
- Minimum distance to the corner of a grid from source
- Count the number of nodes at a given level in a tree using DFS
- Travelling Salesman Problem implementation using BackTracking
- Minimum Operations to make value of all vertices of the tree Zero
- De Bruijn sequence | Set 1
- Minimum time to return array to its original state after given modifications
- Number of Hamiltonian cycle

Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5… Read More »

Given a Weighted Directed Graph and a destination vertex in the graph, find the shortest distance from all vertex to the destination vertex. Input :… Read More »

Prerequisite : Graph and its representations In this article, we will be discussing Adjacency List representation of Graph using ArrayList in Java. Following is adjacency… Read More »

Travelling Salesman Problem (TSP): Given a set of cities and distance between every pair of cities, the problem is to find the shortest possible route… Read More »

Given n expressions of the type x = y and x != y where 1 ≤ x, y ≤ n, the task is to check… Read More »

Given an undirected graph with N vertices and M edges and no self loops or multiple edges. The task is to convert the given undirected… Read More »

Given an undirected graph g, the task is to print the number of connected components in the graph. Examples: Input: Output: 3 There are three… Read More »

Given a graph, the task is to detect a cycle in the graph using degrees of the nodes in the graph and print all the… Read More »

Given a permutation P (P1, P2, P3, … Pn) of first n natural numbers. Find the minimum number of operations to convert it into an… Read More »

Uniform-Cost Search is a variant of Dijikstra’s algorithm. Here, instead of inserting all vertices into a priority queue, we insert only source, then one by… Read More »

Given an edge list of a graph we have to find the sum of degree of all nodes of a undirected graph. Example Examples: Input… Read More »

Given an undirected unweighted connected graph consisting of n vertices and m edges. The task is to find any spanning tree of this graph such… Read More »

Given an array arr[] of size N consisting of distinct integers from range [0, N – 1] arranged in a random order. Also given a… Read More »

Given a connected undirected weighted graph with N nodes and M edges. The task is to perform given queries and find the weight of the… Read More »

Given a directed graph G with N vertices and M edges. The task is to find the length of the longest directed path in Graph.… Read More »