Input/Output/Variables Accessed Flashcards

1
Q

DFS: What is the input, output, and variables we have access to?

A

Input: G = (V, E) Output:* A topological sort on a DAG* undirected graph: ccnum (connected component number)* directed graph: a list of connected componentsAccess to:* prev array* pre array* post array

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

Explore: What is the input, output, and variables we have access to?

A

Input:* G = (V, E)* Start vertex v in VOutput:* visited(u) - visited array which is set to TRUE for all vertices reachable from vAccess to:* ccnum array (ccnum[])* previously visited array (visited[]) * An array of vertices before a given vertex. * Used by Explore and required for DFS.

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

BFS: What is the input, output, and variables we have access to?

A

Input:* G = (V, E)* Start vertex v in VOutput:* dist[] - for all vertices u reachable from the starting vertex v, dist[u] is the shortest path distance from v to u. If no such path exists, infinity otherwise.Access to:* prev[] - vertex preceding u in shortest path from v to reachable vertex u

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

Djikstra’s: What is the input, output, and variables we have access to?

A

Input:* G = (V, E)* Start vertex v in VOutput:* dist[] - for all vertices u reachable from the starting vertex v, dist[u] is the shortest path distance from v to u. If no such path exists, infinity otherwise.Access to:* prev[] - vertex preceding u in shortest path from v to reachable vertex u

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

Bellman Ford: What is the input, output, and variables we have access to?

A

Input:* G = (V, E)* Start vertex v in VOutput:* The shortest path from vertex s to all other vertices.Access to:* Detect negative weight cycles. We can compare T[n, *] to T[n - 1, *]. * We can only find negative weight cycles that can be reached from starting vertex s.

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

Floyd-Warshall: What is the input, output, and variables we have access to?

A

Input:* G = (V, E)Output:* The shortest path from all vertices to all other verticesAccess to:* We can detect negative weight cycles by checking the diagonals (T[n, i, i]).

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

SCC: What is the input, output, and variables we have access to?

A

Input:* G = (V, E)Output:* meta-graph (DAG) that contains the connected components* Topological sorting of the meta-graph * With a source SCC first and a sink SCC lastAccess to:* ccnum[] - strongly connected components produced from the 1st DFS run

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

Kruskal’s: What is the input, output, and variables we have access to?

A

Input:* Connected, Undirected Graph G = (V, E) with edge weights w_eOutput:* An MST defined by the edges E

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

Prim: What is the input, output, and variables we have access to?

A

Input:* Connected, Undirected Graph G = (V, E) with edge weights w_eOutput:* An MST defined by the prev[] array

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

2-SAT: What is the input, output, and variables we have access to?

A

Input:* A Boolean formula in 2-CNF is represented as a set of clauses where each clause is a disjunction of exactly two literals.Output:* A Boolean value indicates whether the given 2-CNF formula is satisfiable. If it is satisfiable, the algorithm may also provide a satisfying assignment of variables.

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

Ford-Fulkerson: What is the input, output, and variables we have access to?

A

Input:* G = (V, E)* Flow capacity c* Source node s* Sink node tOutput:* Max FlowAccess to:* Can trivially create the final residual network with G* Max flow of G

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

Edmonds-Karp: What is the input, output, and variables we have access to?

A

Input:* G = (V, E)* Flow capacity c* Source node s* Sink node tOutput:* Max FlowAccess to:* Can trivially create the final residual network with G* Max flow of G

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