0% found this document useful (0 votes)
479 views15 pages

NP Hard and NP Complete Problems

This document discusses NP-hard and NP-complete problems. It begins by explaining that computational problems can be grouped into those that are solvable in polynomial time and those that are not. NP-hard problems cannot be solved in polynomial time by any known algorithm. NP-complete problems are NP-hard problems that are also in class NP, meaning they can be solved in polynomial time by a non-deterministic algorithm. The document provides examples of NP-hard graph problems like the chromatic number decision problem and travelling salesperson problem. It also discusses the differences between deterministic and non-deterministic algorithms.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
479 views15 pages

NP Hard and NP Complete Problems

This document discusses NP-hard and NP-complete problems. It begins by explaining that computational problems can be grouped into those that are solvable in polynomial time and those that are not. NP-hard problems cannot be solved in polynomial time by any known algorithm. NP-complete problems are NP-hard problems that are also in class NP, meaning they can be solved in polynomial time by a non-deterministic algorithm. The document provides examples of NP-hard graph problems like the chromatic number decision problem and travelling salesperson problem. It also discusses the differences between deterministic and non-deterministic algorithms.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

NP HARD AND NP COMPLETE

PROBLEMS
PRESENTED BY
G.ANGU VIGNESH GURU
BASIC CONCEPTS

The computing times of algorithms fall into


two groups.
Group1– consists of problems whose
solutions are bounded by the polynomial of
small degree.
Example – Binary search
matrix multiplication
BASIC CONCEPTS
• Group2 – contains problems whose best
known algorithms are non polynomial.
• Example –Traveling salesperson problem
knapsack problem
• There are two classes of non polynomial
time problems
1)      NP- hard
2)      NP-complete
NP –HARD AND NP – COMPLETE
PROBLEMS
• A problem which is NP complete will have
the property that it can be solved in
polynomial time if all other NP – complete
problems can also be solved in polynomial
time.
• If an NP-hard problem can be solved in
polynomial time, then all NP-complete
problems can be solved in polynomial time.
• All NP-complete problems are NP-hard, but
all NP-hard problems are not NP-complete.
DETERMINISTIC and
NONDETERMINISTIC ALGORITHMS
• Algorithms with the property that the result of
every operation is uniquely defined are
termed deterministic.
• Such algorithms agree with the way
programs are executed on a computer.
• To specify such algorithms
• we introduce three statements
i)      choice (s) ……… arbitrarily chooses one of the
elements of the set S.
ii)      failure …. Signals an unsuccessful completion.
iii)     Success : Signals a successful completion.
DETERMINISTIC and
NONDETERMINISTIC ALGORITHMS
• Whenever there is a set of choices that leads
to a successful completion then one such set
of choices is always made and the
algorithm terminates.
• A nondeterministic algorithm terminates
unsuccessfully if and only if there exists no
set of choices leading to a successful
signal.
DETERMINISTIC and
NONDETERMINISTIC ALGORITHMS
• A machine capable of executing a non
deterministic algorithm is called a non
deterministic machine.
• While non-deterministic machines do not
exist in practice they will provide strong
intuitive reason to conclude that certain
problems cannot be solved by fast
deterministic algorithms.
Example of a non deterministic algorithm
// The problem is to search for an element x //
// Output j such that A(j) =x; or j=0 if x is not
in A //
j choice (1 :n )
if A(j) =x then print(j) ; success endif
print (‘0’) ; failure
complexity 0(1);
- Non-deterministic decision algorithms
generate a zero or one as their output.
Definition of the classes NP-hard and NP-
complete
• P is the set of all decision problems solvable
by a deterministic algorithm in polynomial
time.
• NP is the set of all decision problems
solvable by a nondeterministic algorithm in
polynomial time.
• Since deterministic algorithm are a special
case of non deterministic ones, we can
conclude that PNP.
• The most famous unsolved problem in
computer science is whether P = NP or P 
NP.
Definition of the classes NP-hard and NP-
complete
Definition : NP-Hard Problem : A problem L is
NP-hard if any only if satisfiability reduces to
L.
Definition : NP-complete Problem :
• A problem L is NP-complete if and only if L is
NP-hard and L є NP.
• There are NP-hard problems that are not NP-
complete.
Definition of the classes NP-hard and NP-
complete
Example :
• Halting problem is NP-hard decision
problem, but it is not NP-complete.
NP-HARD GRAPH AND SCHEDULING
PROBLEMS
1. Chromatic Number Decision Problem (CNP)
• A colouring of a graph G = (V,E) is a function
f : V  { 1,2, …, k}  i  V .
• If (U,V) E then f(u)  f(v).
• The CNP is to determine if G has a colouring
for a given K.
• Satisfiability with at most three literals per
clause  chromatic number problem.
 CNP is NP-hard.
NP-HARD GRAPH AND SCHEDULING
PROBLEMS
2. Directed Hamiltonian Cycle (DHC)
• Let G = (V,E) be a directed graph and length
n = 1V1
• The DHC is a cycle that goes through every
vertex exactly once and then returns to the
starting vertex.
• The DHC problem is to determine if G has a
directed Hamiltonian Cycle.
NP-HARD GRAPH AND SCHEDULING
PROBLEMS
3. Travelling Salesperson Decision Problem
(TSP) :
• The problem is to determine if a complete
directed graph G = (V,E) with edge costs
C(u,v) has a tour of cost at most M.
Sum of subsets
• The problem is to determine if A={a1,a2,
…….,an} (a1,a2,………,an are positive
integers) has a subset S that sums to a
given integer M.
NP-HARD GRAPH AND SCHEDULING
PROBLEMS
• An NP-hard problem L cannot be solved in
deterministic polynomial time.
• By placing enough restrictions on any NP
hard problem, we can arrive at a
polynomially solvable problem.

You might also like