Files
NoteNextra-origin/pages/CSE347/Exam_reviews/CSE347_E2.md
Zheyuan Wu a682a53dc2 ???
2024-11-25 11:23:39 -06:00

2.9 KiB
Raw Blame History

Exam 2 Review

Reductions

We say that a problem A reduces to a problem B if there is a polynomial time reduction function f such that for all x, x \in A \iff f(x) \in B.

To prove a reduction, we need to show that the reduction function f:

  1. runs in polynomial time
  2. x \in A \iff f(x) \in B.

Useful results from reductions

  1. B is at least as hard as A if A \leq B.
  2. If we can solve B in polynomial time, then we can solve A in polynomial time.
  3. If we want to solve problem A, and we already know an efficient algorithm for B, then we can use the reduction A \leq B to solve A efficiently.
  4. If we want to show that B is NP-hard, we can do this by showing that A \leq B for some known NP-hard problem A.

P is the class of problems that can be solved in polynomial time. NP is the class of problems that can be verified in polynomial time.

We know that P \subseteq NP.

NP-complete problems

A problem is NP-complete if it is in NP and it is also NP-hard.

NP

A problem is in NP if

  1. there is a polynomial size certificate for the problem, and
  2. there is a polynomial time verifier for the problem that takes the certificate and checks whether it is a valid solution.

NP-hard

A problem is NP-hard if every instance of NP hard problem can be reduced to it in polynomial time.

List of known NP-hard problems:

  1. 3-SAT (or SAT)
  2. Independent Set
  3. Vertex Cover
  4. 3-coloring
  5. Hamiltonian Cycle
  6. Hamiltonian Path

Approximation Algorithms

  • Consider optimization problems whose decision problem variant is NP-hard. Unless P=NP, finding an optimal solution to these problems cannot be done in polynomial time.
  • In approximation algorithms, we make a trade-o↵: were willing to accept sub-optimal solutions in exchange for polynomial runtime.
  • The Approximation Ratio of our algorithm is the worst-case ratio of our solution to the optimal solution.
  • For minimization problems, this ratio is Ours/OPT, since our solution will be larger than OPT.
  • For maximization problems, this ratio is OPT/Ours, since our solution will be smaller than OPT.
  • If given an algorithm, and you need to show it has some desired approximation ratio, there are a few approaches.
  • In recitation, we saw Max-Subset Sum. We found upper bounds on the optimal solution and showed that the given algorithm would always give a solution with value at least half of the upper bound, giving our approximation ratio of 2.
  • In lecture, you saw the Vertex Cover 2-approximation. Here, you would select any uncovered edge (u, v) and add both u and v to the cover. We argued that at least one of u or v must be in the optimal cover, as the edge must be covered, so at every step we added at least one vertex from an optimal solution, and potentially one extra. So, the size of our cover could not be any larger than twice the optimal.

Randomized Algorithms

Online Algorithms