CDChetan Dattainchetan77.hashnode.dev·Sep 14, 2025 · 3 min readBellman-FordProblem Given an weighted graph with V vertices numbered from 0 to V-1 and E edges, represented by a 2d array edges[][], where edges[i] = [u, v, w] represents a direct edge from node u to v having w e00
CDChetan Dattainchetan77.hashnode.dev·Sep 7, 2025 · 4 min readShortest Path in Undirected GraphProblem You are given an adjacency list, adj of Undirected Graph having unit weight of the edges, find the shortest path from src to all the vertex and if it is unreachable to reach any vertex, then return -1 for that vertex. Examples : Input: adj[][...00