SlideShare a Scribd company logo
NP –Hard and NP –complete problems
#Basic Concepts :
   i)    The distinction between Problems that can be solved by a polynomial time
         algorithm & Problems for which no polynomial time algorithm is known.
   ii)   This makes two groups for computing time of an algorithm soln.

       P problem: a decision problem which can be solved by a polynomial algorithm, such as
the MST decision problem and the longest common subsequence decision problem.
NP problem: a decision problem which can be solved by a nondeterministic
polynomial algorithm,such as the SAT(satisfiability problem ) problem and the traveling
salesperson decision problem.
Every P problem must be an NP problem
(i.e., P ⊆ NP).

Theory of NP-Completeness:
P > The general class of questions for which some algorithm can provide an answer in
polynomial time is called "class P" or just "P".
NP > For some questions, there is no known way to find an answer quickly, but if one is
provided with information showing what the answer is, it may be possible to verify the answer
quickly. The class of questions for which an answer can be verified in polynomial time is called
NP .
NP-Complete
If any NP-complete problem can be solved in polynomial time, NP = P.

Up to now, no NP-complete problem has any worst case
polynomial algorithm.
There are thousands of problems proved to be NP-complete problems.
If the decision version of an optimization problem is NP-complete, this optimization
problem is called NP-hard.
Nondeterministic algorithm
 a deterministic algorithm is an algorithm which, in informal terms, behaves predictably. Given
a particular input, it will always produce the same output, and the underlying machine will always
pass through the same sequence of states.
a nondeterministic algorithm is an algorithm that can exhibit different behaviors on different
runs, as opposed to a deterministic algorithm.
A nondeterministic algorithm performs in three function:
   Choice( ) > chooses one of elements of set S.
   Success ( ) > signals a successful completion.
  Failure ( ) > signals a un-successful completion.

Reducibility

a reduction is a transformation of one problem into another problem.

Depending on the transformation used this can be used to define complexity classes on a set of
problems.

problem A is reducible to problem B if solutions to B exist and give solutions to A whenever A
has solutions.
A very simple example of a reduction is from multiplication to squaring. Suppose all we know

how to do is to add, subtract, take squares, and divide by two. We can use this knowledge,

combined with the following formula, to obtain the product of any two numbers:




COOK’s THEOREM
It states that “satisfiability is in P iff P=NP”
     To explain above theorem consider X1 , X2, X3,X4 are Boolean variables
     X is negation of X.
     Consider the following formula
       A = (X1 X2)         ( X3 X4 ) ----------(i)


        A = (X1       X2)     (X3      X4) --------------( ii)

         Where
                    denotes or (||) And          denotes and (&&).


                                                                                    k
        A formula is Conjunctive Normal Form [CNF] iff it is represented as   i=1        Ci

        Where Ci are clauses each represented as             Lij .

                                                                                              k
     A formula is Dis - Conjunctive Normal Form [DNF] iff it is represented as          i=1       Ci

        Where Ci are clauses each represented as            Lij .

     i.e. (i) is DNF and (ii) is CNF

  The  satisfiability is a process to determine whether the formula is TRUE for some assignment of
truth values to the variables.

Satisfiability is in NP

Hence NP =P.

Satisfiability is in P also.
NP-Hard Graph Problems

The graph coloring problem is the special case of is NP-hard graph problem.

 Definition >
 The graph (or vertex) coloring problem, which involves assigning colors to vertices in a graph
such that adjacent vertices have distinct colors.
 Or
   A coloring of a graph G assigns colors to the vertices of G so that adjacent vertices are given
   different colors.
         The minimal number of colors required to color a graph is called the chromatic number
and denoted

More Related Content

PPT
Np cooks theorem
PDF
PDF
Algorithm chapter 10
PPTX
Dynamic Programming - Part 1
PPT
lecture 30
PDF
Skiena algorithm 2007 lecture16 introduction to dynamic programming
PPTX
NP completeness
PPTX
Np cooks theorem
Algorithm chapter 10
Dynamic Programming - Part 1
lecture 30
Skiena algorithm 2007 lecture16 introduction to dynamic programming
NP completeness

What's hot (20)

PPTX
P vs NP
PPTX
Computability - Tractable, Intractable and Non-computable Function
PDF
Cs6402 design and analysis of algorithms may june 2016 answer key
PDF
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
PDF
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
PDF
P, NP, NP-Complete, and NP-Hard
PPTX
Asymptotic Notations
PDF
P versus NP
PPT
dynamic programming Rod cutting class
DOCX
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
PPT
Dynamicpgmming
PPT
Lecture11
PPTX
dynamic programming complete by Mumtaz Ali (03154103173)
PDF
27 NP Completness
PPTX
Introduction to Algorithms and Asymptotic Notation
PDF
Skiena algorithm 2007 lecture19 introduction to np complete
PPTX
Graph Traversal Algorithms - Depth First Search Traversal
PPT
Introduction to NP Completeness
PDF
Introduction to Approximation Algorithms
P vs NP
Computability - Tractable, Intractable and Non-computable Function
Cs6402 design and analysis of algorithms may june 2016 answer key
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
P, NP, NP-Complete, and NP-Hard
Asymptotic Notations
P versus NP
dynamic programming Rod cutting class
CS 6402 – DESIGN AND ANALYSIS OF ALGORITHMS questio
Dynamicpgmming
Lecture11
dynamic programming complete by Mumtaz Ali (03154103173)
27 NP Completness
Introduction to Algorithms and Asymptotic Notation
Skiena algorithm 2007 lecture19 introduction to np complete
Graph Traversal Algorithms - Depth First Search Traversal
Introduction to NP Completeness
Introduction to Approximation Algorithms
Ad

Similar to Ca notes (20)

PDF
np hard, np complete, polynomial and non polynomial
PDF
9. chapter 8 np hard and np complete problems
PPTX
lec2cct computational cmplexity theory.pptx
PPTX
Lower bound theory Np hard & Np completeness
PPTX
P, NP and NP-Complete, Theory of NP-Completeness V2
PDF
P versus NP
PDF
P, NP, NP-Hard & NP-complete problems, Optimization
PDF
Lect 31_32 NP and Intractability_Part 1.pdf
PDF
UNIT-V.pdf daa unit material 5 th unit ppt
PDF
Basic_concepts_NP_Hard_NP_Complete.pdf
PPT
UNIT-V.ppt
PPTX
PNP.pptx
PPTX
PPT
Complexity theory
PDF
teteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxm
PPTX
Algorithm_NP-Completeness Proof
PPT
NP-Completeewwwwwwwwwwwkkjjejjwjjjjjjjjj
PPTX
Np Completeness
np hard, np complete, polynomial and non polynomial
9. chapter 8 np hard and np complete problems
lec2cct computational cmplexity theory.pptx
Lower bound theory Np hard & Np completeness
P, NP and NP-Complete, Theory of NP-Completeness V2
P versus NP
P, NP, NP-Hard & NP-complete problems, Optimization
Lect 31_32 NP and Intractability_Part 1.pdf
UNIT-V.pdf daa unit material 5 th unit ppt
Basic_concepts_NP_Hard_NP_Complete.pdf
UNIT-V.ppt
PNP.pptx
Complexity theory
teteuueieoeofhfhfjffkkkfkfflflflhshssnnvmvvmvv,v,v,nnxmxxm
Algorithm_NP-Completeness Proof
NP-Completeewwwwwwwwwwwkkjjejjwjjjjjjjjj
Np Completeness
Ad

Recently uploaded (20)

PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
Chapter 5: Probability Theory and Statistics
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPTX
A Presentation on Artificial Intelligence
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
August Patch Tuesday
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Mushroom cultivation and it's methods.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Getting Started with Data Integration: FME Form 101
PDF
Hybrid model detection and classification of lung cancer
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Chapter 5: Probability Theory and Statistics
A novel scalable deep ensemble learning framework for big data classification...
A Presentation on Artificial Intelligence
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
A comparative analysis of optical character recognition models for extracting...
A comparative study of natural language inference in Swahili using monolingua...
NewMind AI Weekly Chronicles - August'25-Week II
1 - Historical Antecedents, Social Consideration.pdf
MIND Revenue Release Quarter 2 2025 Press Release
August Patch Tuesday
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Mushroom cultivation and it's methods.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Getting Started with Data Integration: FME Form 101
Hybrid model detection and classification of lung cancer
Univ-Connecticut-ChatGPT-Presentaion.pdf
Approach and Philosophy of On baking technology
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf

Ca notes

  • 1. NP –Hard and NP –complete problems #Basic Concepts : i) The distinction between Problems that can be solved by a polynomial time algorithm & Problems for which no polynomial time algorithm is known. ii) This makes two groups for computing time of an algorithm soln. P problem: a decision problem which can be solved by a polynomial algorithm, such as the MST decision problem and the longest common subsequence decision problem. NP problem: a decision problem which can be solved by a nondeterministic polynomial algorithm,such as the SAT(satisfiability problem ) problem and the traveling salesperson decision problem. Every P problem must be an NP problem (i.e., P ⊆ NP). Theory of NP-Completeness: P > The general class of questions for which some algorithm can provide an answer in polynomial time is called "class P" or just "P". NP > For some questions, there is no known way to find an answer quickly, but if one is provided with information showing what the answer is, it may be possible to verify the answer quickly. The class of questions for which an answer can be verified in polynomial time is called NP . NP-Complete If any NP-complete problem can be solved in polynomial time, NP = P. Up to now, no NP-complete problem has any worst case polynomial algorithm. There are thousands of problems proved to be NP-complete problems. If the decision version of an optimization problem is NP-complete, this optimization problem is called NP-hard.
  • 2. Nondeterministic algorithm a deterministic algorithm is an algorithm which, in informal terms, behaves predictably. Given a particular input, it will always produce the same output, and the underlying machine will always pass through the same sequence of states. a nondeterministic algorithm is an algorithm that can exhibit different behaviors on different runs, as opposed to a deterministic algorithm. A nondeterministic algorithm performs in three function: Choice( ) > chooses one of elements of set S. Success ( ) > signals a successful completion. Failure ( ) > signals a un-successful completion. Reducibility a reduction is a transformation of one problem into another problem. Depending on the transformation used this can be used to define complexity classes on a set of problems. problem A is reducible to problem B if solutions to B exist and give solutions to A whenever A has solutions.
  • 3. A very simple example of a reduction is from multiplication to squaring. Suppose all we know how to do is to add, subtract, take squares, and divide by two. We can use this knowledge, combined with the following formula, to obtain the product of any two numbers: COOK’s THEOREM It states that “satisfiability is in P iff P=NP”  To explain above theorem consider X1 , X2, X3,X4 are Boolean variables  X is negation of X.  Consider the following formula A = (X1 X2) ( X3 X4 ) ----------(i) A = (X1 X2) (X3 X4) --------------( ii) Where denotes or (||) And denotes and (&&). k A formula is Conjunctive Normal Form [CNF] iff it is represented as i=1 Ci Where Ci are clauses each represented as Lij . k A formula is Dis - Conjunctive Normal Form [DNF] iff it is represented as i=1 Ci Where Ci are clauses each represented as Lij . i.e. (i) is DNF and (ii) is CNF The satisfiability is a process to determine whether the formula is TRUE for some assignment of truth values to the variables. Satisfiability is in NP Hence NP =P. Satisfiability is in P also.
  • 4. NP-Hard Graph Problems The graph coloring problem is the special case of is NP-hard graph problem. Definition > The graph (or vertex) coloring problem, which involves assigning colors to vertices in a graph such that adjacent vertices have distinct colors. Or A coloring of a graph G assigns colors to the vertices of G so that adjacent vertices are given different colors. The minimal number of colors required to color a graph is called the chromatic number and denoted