You are on page 1of 16

UNIT-5

P and NP
• P Problem:
• Problems in which solution can be found in polynomial time.
• NP Problem:
• Problems solution can be verified in polynomial time.

• For doubts visit the below link:


• https://www.youtube.com/watch?v=e2cF8a5aAhE
Relation between P and NP
• P is subset of NP
• No one knows whether P=NP.
Reductions
• We want to solve a problem A.
• We know how to solve problem B.
• Convert input for A into input for B.
• Interpret output of B as output of A.
• A can be reduces to B.
• Can transfer efficient solution from B to A.
• Preprocessing and post processing must be efficient.
• Both problems should be polynomial time.
• For doubts visit the link:
• https://www.youtube.com/watch?v=AhIzCq83c7Q
Satisfiability (SAT)
• Input: Boolean Formula
• Output: can you set the variables to a combination of true or false so
that the formula becomes true.
• Boolean Formula consists of
• Variables (x1,x2,x3….)
• Not ()
• And
• OR
• For doubts visit the below link
https://www.youtube.com/watch?v=Mu5HUvIojJA
NP Hard and NP Complete
• A language B is NP-complete if it satisfies two conditions
• B is in NP
• Every A in NP is polynomial time reducible to B.
• If a language satisfies the second property, but not
necessarily the first one, the language B is known as NP-
Hard.
• Informally, a search problem B is NP-Hard if there exists
some NP-Complete problem A that Turing reduces to B.
• The problem in NP-Hard cannot be solved in polynomial time, until P
= NP.
• If a problem is proved to be NPC, there is no need to waste time on
trying to find an efficient algorithm for it.
• Instead, we can focus on design approximation algorithm.
• NP-Complete Problems
• Following are some NP-Complete problems, for which no polynomial time
algorithm is known.
• Determining whether a graph has a Hamiltonian cycle
• Determining whether a Boolean formula is satisfiable, etc.
• NP-Hard Problems
• The following problems are NP-Hard
• The circuit-satisfiability problem
• Set Cover
• Vertex Cover
• Travelling Salesman Problem
Cooks Theorem
• Any NP problem can be converted to SAT in polynomial time.

• For explanation visit the below links:


• https://www.youtube.com/watch?v=W9G_1xG77LE
• http://www.inf.ed.ac.uk/teaching/courses/propm/papers/Cook.pdf
Circuit SAT
• According to given decision-based NP problem, you can design the
CIRCUIT and verify a given mentioned output also within the P time.
The CIRCUIT is provided below:-
SAT (Satisfiability):-

• A Boolean function is said to be SAT if the output for the given value
of the input is true/high/1
• F=X+YZ (Created a Boolean function by CIRCUIT SAT)
• These points you have to be performed for NPC
• CONCEPTS OF SAT
• CIRCUIT SAT≤ρ SAT
• SAT≤ρ CIRCUIT SAT
• SAT ϵ NPC
• CONCEPT: - A Boolean function is said to be SAT if the output for the given value of the input is
true/high/1.
• CIRCUIT SAT≤ρ SAT: - In this conversion, you have to convert CIRCUIT SAT into SAT within the polynomial
time as we did it
• SAT≤ρ CIRCUIT SAT: - For the sake of verification of an output you have to convert SAT into CIRCUIT SAT
within the polynomial time, and through the CIRCUIT SAT you can get the verification of an output
successfully
• SAT ϵ NPC: - As you know very well, you can get the SAT through CIRCUIT SAT that comes from NP.
• Proof of NPC: - Reduction has been successfully made within the polynomial time from CIRCUIT SAT TO
SAT. Output has also been verified within the polynomial time as you did in the above conversation.
• So concluded that SAT ϵ NPC.
Node/Vertex Cover problem
• Visit the link
• https://www.youtube.com/watch?v=ZZxj9hqldng
Hamilton Circuit Problem
• https://www.youtube.com/watch?v=0v7iLVvvonE
Graph Coloring Problem
• https://www.youtube.com/watch?v=otjOaczA2n4

You might also like