shreyansh

Graphs Problems

  1. Alien Dictionary

    Given a sorted dictionary of an alien language having N words and k starting alphabets of standard dictionary. Find the

  2. BFS

    Only read the BFS part if in hurry.

  3. Bellman Ford

    if distance[u] + w < distance[v], update distance[v] = distance[u] + w.

  4. Count the number of complete components

    You are given an integer n. There is an undirected graph with n vertices, numbered from 0 to n - 1. You are given a 2D i

  5. Course Schedule

    There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prere

  6. Detect Cycle in a graph

    Breadth-First Search (BFS) explores nodes level by level. If a neighbor is encountered that has already been visited and

  7. DisJoint Set

    static class DisjointSet {

  8. Find Eventual Safe States

    There is a directed graph of n nodes with each node labeled from 0 to n - 1. The graph is represented by a 0-indexed 2D

  9. Floyd Warshall

    solving all-pairs shortest path problems, and detecting negative cycles in graphs.

  10. Minimum Height Trees

    A tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected

  11. Minimum cost to connect all points

    You are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi].

  12. Network Delay

    You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed ed

  13. Number Of Provinces

    There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and cit

  14. Number of operations to make a network connected

    There are n computers numbered from 0 to n - 1 connected by ethernet cables connections forming a network where connecti

  15. Prims Algorithm (Greedy Algorithm)

    Run this to see how PRIMS algorithm find MST.

  16. Rotten Oranges

    You are given an m x n grid where each cell can have one of three values:

  17. Topological Sort

    When to use Topological Sort:

  18. is Graph Bipartite

    There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array gra