Graph Runtimes Flashcards

1
Q

What is the runtime of:
DFS Runtime

A

O(n+m)

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

What is the runtime of:
Explore Runtime

A

O(n+m)

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

What is the runtime of:
BFS Runtime

A

O(n + m)

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

What is the runtime of:
SCC Runtime

A

O(m+n)

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

What is the runtime of:
Bellman Ford

A

O(nm)

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

What is the runtime of:
Floyd Warshall

A

O(n^3)

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

What is the runtime of:
Kruskal’s

A

O(m log n)

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

What is the runtime of:
Prims

A

O(m log n)

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

What is the runtime of:
2-SAT

A

O(n+m)

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

What is the runtime of:
Ford Fulkerson

A

O(C m)

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

What is the runtime of:
Edmonds-Karp

A

O(nm^2)

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

What is the runtime of:
Explore on an undirected graph

A

O(m+n) simplifies to O(m)

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

What is the runtime of:
DFS on a connected graph

A

O(m+n) simplifies to O(m)

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

What is the runtime of:
Explore on connected MST

A

O(m+n)

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

What is the runtime of:
DFS on unconnected MST

A

O(m+n)

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

What is the runtime of:
traversing a full graph

A

O(m+n)

Reference: https://edstem.org/us/courses/50892/discussion/4320477

17
Q

What is the runtime of:
reversing a full graph

A

O(m+n)

Reference: https://edstem.org/us/courses/50892/discussion/4320477

18
Q

What is the runtime of:
Accessing a Set?

A

O(n)

19
Q

What is the runtime of:
copying a full graph

A

O(m+n)

Reference: https://edstem.org/us/courses/50892/discussion/4320477

20
Q

What is the runtime of:
iterating, checking, reading, removing, working on all vertices (or subset)

A

O(n)

Reference: https://edstem.org/us/courses/50892/discussion/4320477

21
Q

What is the runtime of:
checking, reading, or removing one edge

A

O(n) or O(m)

Reference: https://edstem.org/us/courses/50892/discussion/4320477

22
Q

What is the runtime of:
iterating, checking, reading, removing, working on all edges

A

O(n+m)

23
Q

What is the runtime of:
Running an O(m+n) black-box algorithm on a MST which is connected

A

O(m)

24
Q

What is the runtime of:
Running an O(m+n) black-box algorithm on a Max Flow which is connected

A

O(m)

25
Q

What is the runtime of:
Accessing an edge property such as a weight

A

O(1)

26
Q

What is the runtime of:
Running DFS on a disconnected graph?

A

O(m+n)