Byte Depth
© 2026 ByteDepth. All rights reserved.Built with care for curious engineers.

All Topics

Graphs43 articles

✕ Clear filter

DSA

Max Area of Island

DFS flood-fill to find the largest connected island. Time O(m×n), Space O(m×n).

Medium·Sep 16, 2026
DSAGraphsBFS🏢 Amazon

DSA

Number of Ways to Arrive at Destination

Graphs. Time O(m log n), Space O(m+n).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Word Search

DFS - Backtracking approach. Optimal — Time O(mn * 4^L), Space O(1).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Word Ladder

Graphs problem — solution with code and analysis.

Hard·Aug 8, 2026
DSAGraphsBFS

DSA

Valid Tree

Graphs problem — solution with code and analysis.

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Surrounded Regions

Graphs. Time O(V^2).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Shortest Path in Binary Matrix

Graphs. Time O(V^2).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Rotten Oranges

Graphs. Time O(V^2).

Medium·Aug 8, 2026
DSAGraphsBFS🏢 Amazon

DSA

Redundant Connection

Graphs. Time O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Path with Minimum Effort

Graphs. Time O(ElogV).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Pacific Atlantic Water Flow

Covers: To Note, DFS, BFS. Optimal — Time O(m x n), Space O(m x n).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Number of Provinces

DFS vs BFS approach. Optimal — Time O(V^2), Space O(n).

Medium·Aug 8, 2026
DSAGraphsBFS🏢 Amazon

DSA

Number of operations to make network connected

Covers: 1. DFS Based, Disjoint Set Based. Optimal — Time O(m * alpha(n), Space O(n).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Connected Components

Covers: DFS, Union Find. Optimal — Time O(V + E), Space O(V).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Network Delay Time

Graphs — single-source shortest path with Dijkstra. Time O(E log V), Space O(V + E).

Medium·Aug 8, 2026
DSAGraphsDijkstra🏢 Google

DSA

Flood Fill

Graphs. Time O(mxn), Space O(mxn).

Easy·Aug 8, 2026
DSAGraphsBFS

DSA

Find the city with the smallest number of neighbors in a threshold distance

Covers: Dijkstra's Algo, Floyd warshall's. Optimal — Time O(n^3), Space O(n^2).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Find Eventual Safe States

Graphs. Space O(V).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Evaluate Division

Graphs. Time O(Q × (V + E), Space O(V).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Course Schedule - IV

Using DFS approach. Optimal — Time O(Q *(N+P), Space O(N+P).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Topological sort - BFS

Graphs. Time O(N), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Detect Cycle in an directed graph - BFS

Graphs. Time O(N), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Detect Cycle in an directed graph - DFS

Graphs. Time O(N), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Detect Cycle in an undirected graph - DFS

Graphs. Time O(N), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Detect Cycle in an undirected graph - BFS

Graphs. Time O(N), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

BFS TRAVERSAL

Graphs. Time O(V+E), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

DFS TRAVERSAL

Graphs. Time O(V+E), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Course Schedule - I

Covers: DFS, BFS - TOPOLOGICAL. Optimal — Time O(N+E), Space O(N).

Medium·Aug 8, 2026
DSAGraphsBFS🏢 Amazon🏢 Google

DSA

Clone Graph

Graphs problem — solution with code and analysis.

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Alien Dictionary

Graphs problem — solution with code and analysis.

Hard·Aug 8, 2026
DSAGraphsBFS🏢 Google

DSA

Minimum Spanning Tree: Prim's Algorithm

Graphs. Time O(ElogE), Space O(V^2).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Minimum Spanning Tree: Kruskal's Algorithm

Graphs. Time O(ElogE), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Shortest Path: Floyd Warshall Algorithm

Alogrithm approach. Optimal — Time O(V^3 ), Space O(V^2 ).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

All Paths From Source to Target

Graphs. Time O(2^N * N), Space O(2^N * N).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Shortest Path Algorithm - Bellman Ford algorithm

5 approaches incl. Negative weight cycle:, Why (V-1) times?, Detection of a Negative Weig…, and more. Optimal — Time O(V*E), Space O(V).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Cheapest Flights Within K Stops

Graphs problem — solution with code and analysis.

Medium·Aug 8, 2026
DSAGraphsBFS🏢 Amazon

DSA

Shortest Path Algorithm - Dijkstra algorithm

Covers: Data structures Used, If path is needed. Optimal — Time O( (E+V), Space O( |V| ).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Strongly Connected Components - Kosaraju's algorithm

The Algorithm approach. Optimal — Time O(V+E), Space O(V+E).

Hard·Aug 8, 2026
DSAGraphsBFS

DSA

Bipartite Graph - DFS

Covers: Sample 1, Sample 2, Observations. Optimal — Time O(N*(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Bipartite Graph - BFS

Covers: Sample 1, Sample 2, Observations. Optimal — Time O(N*(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS

DSA

Course Schedule - II

Using BFS - Kahn's Algo approach. Optimal — Time O(N+P), Space O(N+P).

Medium·Aug 8, 2026
DSAGraphsBFS🏢 Google

DSA

Number of Islands

Graphs. Time O(V^2).

Medium·Aug 8, 2026
DSAGraphsBFS🏢 Amazon

DSA

Topological sort - DFS

Graphs. Time O(N), Space O(V+E).

Medium·Aug 8, 2026
DSAGraphsBFS