Describe the complexity classes of:
- P problems
- NP problems
Is one of them a subset of the other?
In other words, P is the class of all search problems that can be solved in polynomial time
In other words, NP is the class of all well-defined search problems
A problem is NP-complete if it satisfies two conditions. What are they?
Under what case does P = NP?
If a problem takes polynomial time to be verified on a non-deterministic TM (problem is in NP) implies that one can build a deterministic TM which would solve the same problem also in polynomial time (problem is in P).
What does it mean for a problem to be NP-hard?
A problem is NP-hard if it is at least as hard as the hardest problems in NP.
It’s essential to note that NP-hard problems are not necessarily in NP themselves and may not have a polynomial-time verification algorithm.
What is a polynomial-time reduction?
A polynomial-time reduction is a transformation of one problem (A) into another problem (B) such that the transformation and its inverse both take polynomial time.
If problem A can be reduced to problem B in polynomial time, it implies that any solution for problem B can be used to solve problem A in polynomial time. Polynomial-time reductions are crucial in proving NP-completeness.
What’s the definition of a Search Problem?
What is the Decision Problem?
Search Problem: Given a problem instance “I”, find a solution “S” or determine that no such solution exists
Decision Problem: Given a solution “S”, verify that it is a valid solution to “I”
What does it mean for a search problem to be “Well-defined”?
Two things:
nWhat is the traveling salesman problem? (TSP)
Given an undirected graph G = (V,E) along with edge lengths l,
find a tour (a cycle that visits each vertex) in G exactly once and that has the minimum length
What is the traveling salesman problem? (TSP)
Given an undirected graph G = (V,E) along with edge lengths l,
find a tour (a cycle that visits each vertex) in G exactly once and that has the minimum length
With TSP, there is a “optimization” problem variant and a “search” problem variant. What are they?
Optimization problem variant:
Find an optimized tour in G that visits each vertex exactly once and minimizes the length
Search problem variant:
Given a budget b > 0, find a tour that visits each vertex exactly once and has length <= b, or determine that no such tour exists
How does one prove that problem X is in NP-Complete?
What’s the Hamiltonian cycle problem?
What category of NP completeness does it fall under?
Given an undirected graph (not necessarily complete), find a tour that visits each vertex exactly once - or determine that no such tour exists
This problem is NP-complete (no known polynomial-time algorithm can solve it)
What is a reduction?
A reduction is a transformation of one problem (A) into another problem (B) in such a way that a solution for problem B can be used to solve problem A.
Using reductions we can show that two problems are exactly the same, just stated in different ways - and can group together problems in NP
How would you define a reduction as a polynomial-time algorithm?
f that transforms any instance i of A into instance f(i) of Bh that maps any solution S of f(i) back into a solution h(S) of iWhat are Hamiltonian cycle path reductions?
What is an example?
What is a Tree of Reductions?
What is it used for?
A tree of reductions is a hierarchical representation of the relationships between problems based on reductions. The root of the tree represents a known NP-complete or NP-hard problem, such as the Boolean satisfiability problem (SAT).
Given an undirected graph, what’s the difference between a hamiltonian cycle and a hamiltonian path?
Can a reduction be made?
Hamiltonian Cycle: Is there a cycle that passes through each vertex exactly once?
Hamiltonian Path: Given vertices ‘s’ and ‘t’, is there a path from ‘s’ to ‘t’ that passes through each vertex exactly once?
A reduction can be made from HP to HC or also from HC to HP
In terms of NP-Completeness, what category do the following problems fall into:
1. SAT (Boolean Satisfiability Problem)
2. 3SAT (3-CNF Satisfiability Problem)
3. 2SAT (2-CNF Satisfiability Problem)
4. Hamiltonian cycle
5. Hamiltonian path
6. Traveling salesman problem
What are the overlaps between P, NP, NP-Complete and NP-Hard subsets?
.
NP-Hard
What is the fundamental difference between P, NP, NP-Complete and NP-Hard problems?
P
P is a complexity class that represents the set of all decision problems that can be solved in polynomial time.
NP
NP is a complexity class that represents the set of all decision problems for which the solution instances can be verified in polynomial time.
NP-Complete
NP-Complete is a complexity class which represents the set of all problems X in NP for which it is possible to reduce any other NP-Complete problem Y to X in polynomial time.
NP-Hard
Intuitively, these are the problems that are at least as hard as the NP-complete problems (or harder). Note that NP-hard problems do not have to be in NP, and they do not have to be decision problems.