Fall 20 Flashcards

1
Q

What is the algorithm and its runtime of finding the minimum weight path between two arbitrary nodes on a weighted, directed graph

A

O(E log V) – Dijkstra’s algorithm

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

On a weighted, undirected graph, name the algorithm and its runtime for finding the minimum spanning tree of the graph

A

O(E log V) – Prim’s or Kruskal’s algorithm

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

On an unweighted, undirected graph, name the algorithm and its runtime for finding the shortest path between two arbitrary nodes on the graph

A

O(V+E) – BFS

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

On a weighted, directed graph, name the algorithm and its runtime for determining whether two nodes of the graph are connected

A

O(V+E) – DFS

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

On a weighted, directed acyclic graph, name the algorithm and its runtime for determining the minimum weight path between two arbitrary nodes in the graph

A

O(X+Y) – Topological sort

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

On a weighted, directed graph, what is the runtime of finding an augmenting path through t he graph when implementing network flow with the Edmonds-Karp algorithm

A

O(V+E)

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

T/F If G is an NP complete problem, then G may be solved in exponential time with enumeration

A

True – We know its exponential, but we don’t know if its polynomial

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

T/F if G is an NP complete problem, the G must be framed as a yes or no question, and a yes answer must be verifiable in polynomial time

A

True – definition of NP

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

Let G be an NP complete problem. if you can solve G in time O(T), then you can solve the 3-SAT problem in time O(Tp), where p is a polynomial of the input size G and 3-SAT.

A

True – That’s the complete part of NP complete

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

If G is an NP complete problem, then G may not be solved in polynomial time

A

False – we don’t know

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

If G is an NP complete problem, then you prove that G is NP-complete by taking an instance of G, mapping it to a known NP-Complete problem like 3-SAT in polynomial time, and showing that if you can solve 3-SAT in polynomial time, then you can solve G in polynomial time.

A

False – its the other way around

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

If G is an NP complete problem, then G must be framed as a yes/no question, and a no answer must be verifiable in polynomial time

A

False – this is from the definition of NP

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

You are sorting therr following string using quicksort:
l p g s v l f f f e b w l
If you use the first character as a pivot, what will the string be right before you make the first recursive call

A

f l g b e f f l l v s w p

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

If you are trying to find the minimum spanning tree, and you have a sorted list of the edges, which algorithm should you use to find the minimum spanning tree

A

Kruskal’s algorithm.

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

Describe the process for topological sort

A

Maintain a list of nodes with no incoming edges.

Until the list is empty, remove a node from the list and append it to the topological sorting. For each edge coming out of the node, remove the edge from the graph; if that edge was to a node that now has no more incoming edges, put that node in the list.

Repeat until the list is empty.

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