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*
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What algorithms can you use to solve connectivity problems?

A

Union find data structure, DFS, BFS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What algorithms can you use to solve negative cycles problems?

A
  • Bellman-Ford

- Floyd-Warshall

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What algorithms can you use to solve strongly connected components problems?

A
  • Tarjan’s

- Kosaraju’s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What algorithms can you use to solve minimum spanning tree problems?

A
  • Kruskal’s

- Prim’s & Boruvkas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What algorithms can you use to solve Network flow: max flow problems?

A
  • Ford-Fulkerson

- Edmonds-Karp & Dinic’s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Whats the time complexity of DFS?

A

O(V+E) vertices + edges

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Whats the time complexity of BFS?

A

O(V+E) vertices + edges

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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]);
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly