Unit-5 DAA-2
Unit-5 DAA-2
Case 1: If ei < p < ej, then ei and ej will never be compared as they fall into different partitions.
Case 3: If p < ei < ej or ei < ej < p, then ei and ej will fall into same bucket and another pivot will be chosen.
Is {7,3,1} a solution: NO
TRUE
1. P is a subset of NP
2. NPC is a subset of NP
3. NPC is a subset of NPH
NOT KNOWN
1. NP is a subset of P
2. P = NP
If P = NP
3. P = NP = NPC is a subset of
NPH
If P is not equal to NP
4. P (intersection) NPC = empty
5. P (intersection) NPH = empty
How to show that a problem L is NP-Complete
1. Prove: L is in NP.
2. Prove: L is NP-Hard. That is, all problems in NP are poly-time reducible to L.
Construction of G
● Each clause in φ will be represented as a set of three nodes, one for each
literal.
● The nodes will all be connected, except that no nodes from the same clause
will be connected and no two nodes with contradictory labels will be connected
(i.e. x1 and ~x1 shall not share an edge)
φ=(~x1∨ x2∨ x3)
∧ (x1∨~x2 ∨
~x3) ∧ (x1 ∨ x2 x1 x2 x3
∨ x3)
~x1 x1
x2 x2
x3 x3
An example
Proof (optional)
Theorem: φ is satisfiable iff G has a k-clique:
Assume φ is satisfiable. In each clause, at least one literal is true. Select one
node which has a true literal as its label from each clause. The nodes selected
form a k-clique since the nodes are selected one from each clause. The labels
are connected since they cannot be contradictory.
(Conversely) Assume G has a k-clique. Assign each of the literals in the labels
of the clique to be true. Because nodes from the same clause are not
connected, a k-clique must visit k clauses. No contradictions will be
encountered since contradictory labels are not connected. Thus each clause
contains at least one true literal, which means that φ is satisfied.
The light grey vertices form the minimum vertex cover.
| A | ≤ | C* |
Since each execution of line 4 picks an edge for which neither endpoint is yet in C and adds these two vertices to C, then
we know that
|C| = 2|A|
Therefore:
| C | ≤ 2 | C* |
That is, |C| cannot be larger than twice the optimal, so is a 2-approximation algorithm for Vertex Cover.