Graphs Flashcards
1
Q
What algorithms can you use to solve shortest path problems?
A
- BFS (if graph is unweighted)
- Dijkstra
- Bellman-Ford
- Floyd-Warshall
- A*
2
Q
What algorithms can you use to solve connectivity problems?
A
Union find data structure, DFS, BFS
3
Q
What algorithms can you use to solve negative cycles problems?
A
- Bellman-Ford
- Floyd-Warshall
4
Q
What algorithms can you use to solve strongly connected components problems?
A
- Tarjan’s
- Kosaraju’s
5
Q
What algorithms can you use to solve minimum spanning tree problems?
A
- Kruskal’s
- Prim’s & Boruvkas
6
Q
What algorithms can you use to solve Network flow: max flow problems?
A
- Ford-Fulkerson
- Edmonds-Karp & Dinic’s
7
Q
Whats the time complexity of DFS?
A
O(V+E) vertices + edges
8
Q
Whats the time complexity of BFS?
A
O(V+E) vertices + edges
9
Q
What’s the main if statements in a loop checking for bridges?
A
if (!visited) { dfs() low[at] = min(low[at], low[to]); if (ids[at] < low[to]) { // found bridge } } else { low[at] = min(low[at], ids[to]); }