You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**Breadth-First Search (BFS)**| Finding the shortest path in unweighted graphs, level-order traversal. | Use a queue to process nodes in a First In, First Out (FIFO) manner. |
248
+
|**Depth-First Search (DFS)**| Topological sorting, cycle detection, pathfinding. | Use recursion or a stack to explore as deep as possible before backtracking. |
249
+
|**Dijkstra's Algorithm**| Shortest path in weighted graphs with non-negative weights. | Use a min-heap (priority queue) to select the next node with the smallest tentative distance. |
250
+
|**Bellman-Ford Algorithm**| Shortest path in graphs with negative weights, detecting negative cycles. | Relax all edges V-1 times, where V is the number of vertices. |
251
+
|**Floyd-Warshall Algorithm**| All pairs shortest paths. | Use a 2D matrix to store distances, updating distances by considering each vertex as an intermediate point. |
252
+
|**Union-Find Data Structure**| Keeping track of disjoint sets, cycle detection in Kruskal's algorithm. | Optimize with path compression and union by rank for efficient merging of sets and lookups. |
0 commit comments