Algorithms Final Exam ORDER OF MAGNITUDE IS IN SQUARE BRACKETS LIKE O[n]

¡Supera tus tareas y exámenes ahora con Quizwiz!

source, sink, capacity

A flow network is a special directed graph with two special vertices: the ______ s and the ____ t. Each edge of this graph has a ________ c(u.v) > 0.

decision

A problem restricted to a yes or no answer is called a ________ problem. You can phrase most optimization problems in this form.

max flow problem

The problem where you need to assign legal flow values to each edge in a flow network in a way that maximizes how much flow goes from the source to the sink

vertex cover

The problem with a graph and an integer k. The question: is there a subset of at most k vertices do that every edge has at least one of it's vertices in the subset? This can be solved and proven NP with 3-SAT

DFS

The type of search you can use to classify each edge (u,v) (check the color of v that is reached by exploring the edge. white = tree, gray = back, black = forward or cross) (it the graph is undirected an DFS will reveal only tree or back edges)

encodings

There are many possible ways to encode the input graph for a problem. All reasonable _________ will be withing polynomial size of each other so we can ignore minor differences.

union-find, path compression

There are two ways we can optimize union and find operation speed when trying to speed up Kruskal's algorithm. One is by making ______-____ trees by merging the smaller tree into the bigger one with every union operation. The next is ____ ___________ where when we look for and find x we re-balance the tree so x is the root.

cut

a ___(S, T) of a flow network is a way of dividing the network into two halves. Every edge that crosses the cut from L to R contributes to the net capacity of the cut.

path

a ____ is a sequence of edges connecting two verticies

flow function

the ____ ________ specifies the three rules a flow network must follow: (1) flow along each edge must not exceed the edge's capacity, (2) flow on an edge is equivalent to the negative flow of it's residual edge (3) The amount flowing into a non s or t vertex is the same as the amount flowing out of it

vertex coloring

the ______ ________ problem seeks to assign a label (or color) to each vertex such that no edge links any two vertices of the same color.

degree

the _______ of a vertex is the number of edges adjacent to it

connected components

the _________ __________ of an undirected graph are the separate pieces of the graph with no connection between them

O[n^3]

the complexity of the floyd warshall algorithm. It isn't the best complexity compared to Dijkstra's but the algorithm is appealing because it is much easier to understand and implement.

inverse ackermann function

the function that is almost constant time and is part of the complexity of kruskal's algorithm. It's parameters grow very slowly and are inverse to the number of atoms in the universe.

implicit

the name for a graph that is not explicitly constructed and then reversed but instead built as we use it.

greedy

the optimal solution for a Minimum Spanning Tree is best found with a ______ algorithm and clever data structures. MST has many applications especially network construction.

maximum bipartite matching problem

the problem where you are trying to find a matching with the greatest number of edges

Satisfiability

the problem where you have a set V of variables and a set of clauses C over V. Question: is there a truth assignment to V such that each clause in C is (sanctimoniously) satisfied?

residual graph

the residual graph is like a second shadow graph in a flow network where for every edge between vertices u and v there is a second edge with capacity 0 from v to u. The residual capacity of an edge is it's capacity minus it's current flow. BFS and DFS can now be used/

flow network

the solution to the maximum bipartite matching problem is to make it into a ____ _______ by adding a source s connecting to every vertex in X and a sink t for Y, a weight of 1 on every edge, and running the max flow algorithms on it.

matching

the word that describes a set of edges in the bipartite graph that have no endpoints in common

Edmonds-Karp algorithm

this algorithm is identical to ford-fulkerson except it specifies how augmenting paths must be computed with breadth first traversal.

Max-Flow Min-Cut Theorem

this theorem states that if you make all the possible cuts on a flow network and find the minimum capacity of these that minimum capacity is also equal to the maximum flow you can get.

n, m

we assume graph G = (V,E) contains _ vertices and _ edges

reduction

what it's called when you translate an instance of one type of problem into an instance of another type of problem

directed

a _________ graph is a connected directed graph G where vertices of G can be slit into two sets X and Y so that every edge of G has one endpoint in X and one in Y

topological sort

a ___________ ____ of a graph is an ordering on the vertices so that all edges go from left to right. A useful application of this is scheduling jobs in their proper order.

tree

a connected graph with no cycles

strongly connected

a directed graph is ________ _________ if there is a directed path between any two verticies

undirected

a graph G=(V,E) is __________ if for every edge (x,y) in E, edge (y,x) is also in E

acyclic, cyclic

a graph graph that does not contain any cycles is called _______ (compare to ______ graphs that do)

labeled

a graph is _______ if each vertex is assigned a unique identifier to distinguish it from all other vertices

weighted

a graph is ________ if each edge (or vertex) is assigned a numerical value or weight

embedded, topological

a graph is ________ if the vertices and edges have been assigned geometric positions. (compare to ___________)

bipartite

a graph is _________ if it can be colored with no conflicts and only two colors. We can use BFS to try to find a two-coloring.

sparse, dense (dense graphs have a quadratic number of edges while sparse graphs are linear in size)

a graph is called ______ when a small fraction of vertex pairs actually have edges defined between them, and _____ when the fraction is high

simple

a graph with no self-loops or multi-edges is called:

cycle

a path where the last vertex is adjacent to the first (it is also called simple if no vertex repeats)

P

a problem is in _ if it can be solved in time polynomial in the size of the input

NP

a problem is in __ if when given an answer you can verify if that answer is correct in polynomial time

instance

a problem with the inputs specified is called an ________

augmenting path

a sequence of edges in a flow network from s to t along which flow can be increased (sometimes will traverse edges in reverse direction) BFS/DFS cannot find this

minimum spanning tree

a spanning tree of weighted graph G whose edges sum to the minimum weight

spanning tree

a sub-graph of graph G which has the same set of vertices of G and is a tree

isomorphism testing

an important graph problem that determines weather the topological structures of two graphs are identical if we ignore labels

connected

an undirected graph is _________ if there is a path between any two vertices

breadth-first traversal

one of the two primary traversal algorithms we use when we want the shortest path on unweighted graphs. Discovered vertices are stored in a FIFO queue.

depth-first search

one of the two primary traversal algorithms we use when we want to exhaustive search all possibilities. It is best understood as a recursive algorithm and uses a FILO stack for discovered vertices.

adjacency matrix

one of the two ways to represent graph G. We use an n x m matrix M, where element M[i,j] is 1 if (i,j) is an edge of G (and 0 if it isn't). This takes a lot of space.

adjacency list

one of the two ways we can represent graph G. we use an array of n pointers where the ith element points to a linked list of the edges incident on vertex i. To test of edge (i,j) is in the graph we search the ith list for j, which takes O[di] where di is the degree of the ith vertex. (this uses less space)

graph

A _____ G=(V,E) is defined by a set of vertices V, and a set of edges E consisting of ordered or unordered pairs of vertices from V

DAG

A directed graph is a ___ iff no back edges are encountered during a depth first search. Theorem: arranging vertices in decreasing order of DFS finish times gives a topological sort of it. This is why topological sorting takes O(n+m) time.

3-Satisfiability

A version of the satisfiability problem where each clause contains 3 literals. If this were NP complete, SAT would be too, but not vice versa.

4

Clause C contains k literals. If k is 1 (C={z1}) we make two new variables and _ new 3-literal clauses that each contain z1 and a different combination of the new variables.

2

Clause C contains k literals. If k is 2 (C={z1,z2}) we make one new variable and _ new 3-literal clauses that each contain z1 and z2 and a different version of the new variable.

1

Clause C contains k literals. If k is 3 (C={z1,z2,z3}) we make no new variables and _ new 3-literal clause that contains z1, z2, and z3

k-3, k-2

Clause C contains k literals. If k is > 3 we make a chain of clauses. Each clause is linked by a new variable at the end of clause one and it's complement at the beginning of clause two. Between these links there are the literals from C. In total there are ___ new variables and ___ new clauses.

O[n+m]

Cost of finding the shortest path in an unweighted graph with BFS

DFS

Finding Cycles is an application of ___ because every back edge we find will indicate a cycle

O[mn], O[m log m], O[n a(n)]

List the complexities of Kruskal's algorithm with (1) simple sorting and BFS/DFS to test for cycles, (2) maintaining which werticies are in which component, eliminationg the need for a cycle chack and (3) with the specialized data structure union find trees and path compression (a is for inverse ackerman)

Prim's Algorithm

One of the greedy algorithms to find an MST. This algorithm starts at any one vertex and grows the rest of the tree one connected edge at a time. At each decision point we pick the cheapest edge that doesn't create a cycle.

Kruskal's Algorithm

One of the greedy algorithms to find an MST. This algorithm starts by finding the smallest edge in the whole graph and adding that to the tree. It then finds the next smallest edge that does not create a cycle and adds that and so on.

sets

P and NP are ____ of problems

SAT, 3-SAT, X

The direction of the reductions for satisfiability: ___ then _____ then _

DAG

The name for a directed acyclic graph. (these arise naturally in scheduling problems where a directed edge (x,y) indicates that x must come before y)

reducing

________ one algorithm problem A to another problem B is an argument that if you can figure out how to solve B then you can solve A. Many algorithmic problems are reducible to sorting.

find, union

We can speed up Kruskal's algorithm with a specialized data structure. It represents each set as a tree with pointers from each node to it's parent. It uses two helper functions, ____(i) and _____(i,j) that return the label of the tree containing a certain node and merge two trees together respectivly.

every

We must transform _____ instance of a known NP complete problem to an instance of the problem we are interested in.

undiscovered, discovered, processed

When traversing a graph every vertex is in one of three states. ____________, the initial state, _________, the vertex after we have encountered it but before we check out it's incident edges, and _________, after we have visited all it's incident edges.

adjacency list

Which can easily be adapted to support edge-weighted graphs: adjacency matrix or adjacency list?

adjacency list

Which is faster at finding vertex degree: adjacency matrix or adjacency list?

adjacency matrix

Which is faster at testing if edge (x,y) exists: adjacency matrix or adjacency list?

adjacency matrix

Which is fastest at edge inserting or deletion (at O(1) time): adjacency matrix or adjacency list?

adjacency list

Which makes the graph faster to traverse (at m+n time instead of n^2): adjacency matrix or adjacency list?

adjacency matrix

Which uses less memory on dense graphs: adjacency matrix or adjacency list?

adjacency list

Which uses less memory on sparse graphs (m+n vs. n^2): adjacency matrix or adjacency list?

articulation vertex

an ____________ ______ is a vertex of a connected graph whoes deleting disconnects the graph. We find them in O(n(m+n)) by deleting each vertex in turn and running a DFS/BFS of what's left.

ford-fulkerson algorithm

an algorithm for finding the max flow in a flow network. All flows are initialized to 0 and while there exists an augmenting path p flow is augmented along it

self-loop

an edge (x,x) in a graph is called a:

multi-edge

an edge (x,y) is a __________ if it occurs more than once in the graph

cross edge

one of the four edge classifications: the _____ ____ goes from one node to another and neither node is related

O[nm]

complexity of maximum bipartite matching problem when using a flow network

O[nm^2]

complexity of the edmonds-karp algorithm

forward edge

one of the four edge classifications: the _______ ____ goes from an ancestor to a decedent that is not a child

parenthesis theorem

if vertex u's range is (d[u], f[u]) then for any pair of vertices u and v exactly one of the following holds: (1) u's range and v's range are disjoint, (2) u's range is contained in v's range (u is a decedent of v in DFT), (3) v's range is contained in u's range (v is a decedent of u in DFT)

O[nm], O[n^2], O[m+nlogn]

list the complexities of prim's algorithm on graph of size n when you (1) use simple BFS/DFS to find smallest weighted edge, (2) find a was to figure out smallest weighted edge in O[n] time, (3) use Fibonacci heaps (smart priority queue)

O[m log n], O[n log n + m]

list the costs of performing Dijkstra's algorithm with (1) a min heap and (2) a Fibonacci heap

Floyd Warshall Algorithm

one of the algorithms to find a shortest path on a weighted graph by developing a recurrence relation that yields a dynamic programming formulation with nice tight loops.

Dijkstra's Algorithm

one of the algorithms to find the shortest paths in a weighted graph (because BFS cannot) that uses a dynamic programming like strategy and stores the distance from s to all nearby nodes and uses that info to find the shortest path to more distant nod

tree edge

one of the four edge classifications: the ____ ____ goes directly from a parent to a child

back edge

one of the four edge classifications: the ____ ____ goes from a decedent to an ancestor that is not its parent


Conjuntos de estudio relacionados

Fluid and Electrolytes (Fluid volume deficit)

View Set

Quiz Block 4: PUNCTUATION/MECHANICS: Commas I, paragraph editing

View Set

Environmental earth science final

View Set

Hesi Final Study Questions: Med Surg II

View Set

Chapter 23: Gynecologic Emergencies

View Set