8
P, NP Problems

P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

P, NP Problems

Page 2: P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

5/1/2006 Algorithm Analysis and Design CS 007 BE CS 5th Semester 2

Tractable and Intractable

All the algorithms done so far have been polynomial time algorithms with worst case running time as O(nk). So these problems are regarded as tractable.The problems requiring time in higher degree polynomial may may be regarded as intractable but there are very few that come in this category.A problem that can be solved polynomially in one model can also be solved polynomially in other model.

Page 3: P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

5/1/2006 Algorithm Analysis and Design CS 007 BE CS 5th Semester 3

Closure Property

The class of polynomial time solvable problems has nice closure properties, since polynomials are closed under addition, multiplication and composition. E.g. if output of one polynomial time algorithm is put into another, the composite algorithm is polynomial.

Page 4: P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

5/1/2006 Algorithm Analysis and Design CS 007 BE CS 5th Semester 4

Relationship

Page 5: P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

5/1/2006 Algorithm Analysis and Design CS 007 BE CS 5th Semester 5

P and NPA problem belongs to the class P if the problem can be solved by a polynomial-time algorithm.

A problem belongs to the class NP if the correctness of the problem’s solution can be verified by a polynomial-time algorithm.

e.g. whether a given path of given length k exists between given s and t nodes in a graph g can be found using polynomial time. So actually we convert the problem into a decision problem and verification can be done in polynomial time.

Page 6: P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

5/1/2006 Algorithm Analysis and Design CS 007 BE CS 5th Semester 6

Approximation

For NP-complete problems it may be possible to find the near optimal solution in polynomial time. An algorithm that returns near optimal solution is called as approximation algorithm.

Є-approximation: an approximation algorithm is an Є-approximation algorithm if for any Є >0, the scheme runs in time polynomial in the size of n of its input instance for a range of error upto Є.

Page 7: P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

5/1/2006 Algorithm Analysis and Design CS 007 BE CS 5th Semester 7

NP-hard & NP-complete

A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial solutions for every problem in NP)NP-complete problems are the NP-hard problems that are also in NP(The existence of a polynomial-time algorithm for an NP-complete problem implies the existence of polynomial solutions for every problem in NPTill now no polynomial time algorithm has been discovered for any NP-hard or NP-complete problems.

Page 8: P, NP Problems · A problem is NP-hard if it is as hard as any problem in NP. (The existence of a polynomial-time algorithm for an NP-hard problem implies the existence of polynomial

5/1/2006 Algorithm Analysis and Design CS 007 BE CS 5th Semester 8

DeterminismIf the result of every operation is uniquely defined then the algorithm is called deterministic algorithm.If we allow algorithms to contain operations whose outcome is not uniquely defined but is limited to a specific set of possibilities. This leads to the concept of non-deterministic algorithm.j<- choice(1:n)If A(j) = x then print j; success; endifPrint’0’; failure;