Sunteți pe pagina 1din 3

1.

3-CNF-SAT: Boolean satisfiability in conjunctive normal form; each clause


has three elements. Note that any boolean satisfiability can be
written in this fashion.
2. k-COLOR (k 3): Given a graph G, determine whether G can be colored using k
colors.
3. 3-D-Matching: Given disjoint sets X, Y, and Z, each of size n, and given a
set T X Y Z of ordered tuples, does there exist a set of
n tuples in T such that each element of X Y Z is in
exactly one of these tuples?
4. BIN-PACKING: Given a set of n objects, each with a weight, as well as values
K and B, can you place all the objects into at most K bins,
such that each bin has no more than B total weight?
5. CLIQUE: Given a graph G and integer k, determine if there is a clique of
size k or larger in G.
6. DOMINATING SET: Given a graph G and an integer k, determine if there is some
subset of the vertices V', |V'| k, such that each vertex
is either in V' or adjacent to one that is.
7. HAMILTONIAN-CIRCUIT: Given a graph G, determine whether G has a circuit
(cycle) that passes through each vertex exactly once.
8. HAMILTONIAN-PATH: Given a graph G and two nodes s and t, determine whether G
has a path which visits every vertex exactly once,
beginning from s and ending at t.
9. KNAPSACK: Given a set of n objects, each with a weight and a value, as well
as values W and V, can you choose objects with total weight W
and total value V?
10. INDEPENDENT SET: Given a graph G and an integer k, determine if there is
some subset of the vertices V', |V'| k, such that no two
vertices in V' share an edge.
11. PARTITION: Given a list of numbers, determine if the list can be split into
two lists such that each element is in exactly one list and the
two lists have the same sum.
12. SET COVER: Given a collection of n sets and a value k, can you select no
more than k sets such that every element in the n sets appears
in at least one of the k chosen sets?
13. SPARSEST SUBGRAPH: Given a graph G and integers s and k, determine if there
is a subset of the vertices V', |V'| s, such that |E'|
k.
14. SUBGRAPH-ISOMORPHISM: Given graphs G1 and G2 and an integer k, determine
whether there exist subgraphs G1' and G2' that are
isomorphic and have at least k vertices.
15. SUBSET-SUM: Given a set S of numbers, as well as a number k, determine if
there is a subset of S that sums to exactly k.
16. TRAVELING SALESMAN: Given a complete weighted graph G and a value D, find a
cycle that contains each vertex exactly once, such that
the total weight of edges is no more than D.
17. VERTEX-COVER: Given a graph G and integer k, determine if there is some
subset of the vertices V', |V'| k, such that each edge is
incident to some vertex in V'.

Packing: Pick at least k objects; constraints don't let you pick at all.
Independent set, set packing, combinatorial auctions.
Covering: Pick at most k objects.
Vertex cover, Steiner tree, dominating set, TSP.
Partitioning: Partition all n objects into k-sets.
3D matching, 3-coloring.

Numeric: Select some objects, subject to a weight constraint.


Subset sum, knapsack.
Constraint satisfaction: 3SAT, boolean logic.
Graph: Vertex cover, independent set, Steiner tree, dominating set.
Sequencing: Permute objects in some fashion.
Hamiltonian cycle, directed-path HC, TSP.
For some "reduce X to Y" problem:
Suppose true for X -> false negatives
Suppose true for Y -> false positives
With the additional , the runtime for the Ford-Fulkerson algorithm becomes
O(m^2logC). At most 2m^2 flow is added each phase. 2m phases. is
initially 2^log2C. Before the adaptation, the runtime is O(mC).
Graph reductions include:
1. Max-flow/min-cut
2. Bipartite matching
3. Edge disjoint paths
4. Circulation w/ supply and demand
5. Lower and upper bounds
Use an exchange argument for greedy algorithms! Always consider comparing an
OPT and COMP algorithm, and show how you are always keeping up with OPT.
Permutation (often a sort), packing (Mi Ci), interval coloring.
For dynamic programming, it's very often something that looks like:
min { some expression ... }
0<j<k
This subsequently translates into some matrix representation. Or you
might have something like subset-sum, where a running counter occupies
the top row.

Bellman-Ford: Minimum cost of a v->t path. O(nm).


All Pairs Shortest Paths: O(n^3). Works for negative cost edges. Compare with
Dijkstra's that yields O(n) * O(mlogn).
MST: Prim's (Dijkstra adaptation for D(u)), Kruskal's (employs Union-Find).
Always note the CUT PROPERTY (minimum cost edge connecting S, V-S is in
the MST) and the CYCLE PROPERTY (most expensive edge in a cycle does
not belong to any MST.)
Union-find helps keep track of disjoint sets. It allows you to run:
Merge(a, b), Same?(a, b), Find(a) in O(logn). The total complexity is
something like O((n + m) * (K)). The bottleneck is the initial sort;
O(nlogm).
Shortest path algorithm: Dijkstra's largely relies on the property that for
each step the edge with smallest (D(u) + lu) will be
added to the set S. It uses the heap structure. This
means: Find min O(1), Add O(logn), Delete min
O(logn), Update key O(logn). We populate O(nlogn),
Extract min n times, Change key m times. O(mlogn).

Breadth first and depth first both run in O(n + m).


We can perform a topological sort by counting the in-degrees. O(n + m).
We can find all paths *to* some vertex v by finding Grev. O(n + m).
A simple cycle is a simple path on the first k-1 vertices, then v1 == vk.
A DAG has no cycles.
T(n) = aT(n/b) + f(n) for some a 1, b > 1, and f(n) asymp. positive.
n/b can be either floor or ceiling. Then taking k = logba
If f(n) is O(n^(k - )) for > 0, th n T(n) is (n^k).
If f(n) is (n^k), th n T(n) is (n^klogn).
If f(n) is (n^(k + )) for > 0, and if af(n/b) cf(n) for som
constant c < 1 and for all suffici ntly larg n th n T(n) = (f(n)).

S-ar putea să vă placă și