Você está na página 1de 6

UNIT VIII

NP-Hard and NP-Complete problems: Basic concepts, nondeterministic algorithms, The classes-
NP-Hard and NPComplete, Cook's theorem.
Basic concepts : Algorithms are divided into to t!pes.
". Pol!nomial time algorithms
#. Non Pol!nomial $e%ponential& time algorithms
Pol!nomial time algorithms have time comple%it! $ &
a
O n here n is the inp't si(e and )a* is
an! constant. +%amples are linear search$
$ & O n
&, binar! search$
#
$log $ && O n
, mergesort , b'bblesort$
#
$ & O n & etc.
Non-Pol!nomial time algorithms have time comple%it! $ &
n
O a here n is the inp't si(e and
)a* is an! constant. +%amples are travelling sales person problem$ $# &
n
O &, s'm o, s'bsets problem,
etc.
-e don*t re.'ire e%ponential time algorithms, as the! take h'ndreds o, !ears to get e%ec'ted
in o'r comp'ter $deterministic machine&.
/o, e tr! to solve some o, these e%ponential time algorithms in pol!nomial time b! 'sing a
h!pothetical machine $non-deterministic machine&.
Non-deterministic Algorithms
Algorithms, hich 'se the propert! that the res'lt o, ever! operation is 'ni.'el! de,ined, are
termed deterministic algorithms$o'tp't is deterministic&. /'ch algorithms agree ith the a!
programs are e%ec'ted on a comp'ter. Algorithms that contain operations hose o'tcomes are not
'ni.'el! de,ined b't are limited to speci,ied sets o, possibilities are called non-deterministic
algorithms$o'tp't is non deterministic&. The machine e%ec'ting s'ch operations is alloed to choose
an! one o, these o'tcomes s'b0ect to a termination condition to be de,ined later.

Ne ,'nctions that are la'nched in non-deterministic algorithms are given belo:
" Choice$s& arbitraril! chooses one o, the elements o, set /.
# 1ail're$& signals an 'ns'ccess,'l completion.
2 /'ccess$& signals a s'ccess,'l completion.
The assignment statement %:3Choice$",n& co'ld res'lt in % being assigned an! one o, the
integers in the range 4",n5. There is no r'le speci,!ing ho this choice is to be made. A
nondeterministic algorithm terminates 'ns'ccess,'ll! i, and onl! i, there e%ists no set o, choices
leading to a s'ccess signal. That means 6A non-deterministic machine ala!s tries to s'cceed7. The
comp'ting times ,or Choice, /'ccess and 1ail're are taken to be 8$"&.
No, e can classi,! algorithms as:
P : The set o, all problems that are solvable b! deterministic machine in pol!nomial time
NP: The set o, all problems that are solvable b! non-deterministic machine in pol!nomial time.
9, e kno, sol'tion to an NP problem, then e can veri,! hether that sol'tion is right or
rong b! 'sing o'r deterministic machine in pol!nomial time. /o, NP can also be de,ined as,
NP: The set o, all problems that can be veri,ied b! o'r deterministic machine in pol!nomial time.
"
Note: There are some problems hich can*t be solved in pol!nomial time, even b! 'sing the non-
deterministic machine.
/ome o, the non-deterministic algorithms are given belo.
#
2
:
The classes-NP-Hard and NPComplete
;ed'cibilit!: <et < and ; be to problems. -e sa! that <

; $read as < red'ces to ;&, i,,


$i& -e are able to convert an instance o, < into an instance o, ;
$ii& /olve ;
$iii& 1rom the sol'tion o, ; i, e are able to get sol'tion to <.
Pol!nomial time red'ction: 9n the above de,inition, let < be a problem in NP, and ; be a problem in
P, then, e sa! that a problem in NP $<& has a pol!nomial time red'ction in P $;&.
-e don*t kno hether all problems in NP have pol!nomial time red'ctions in P are not. That
is e don*t kno hether P3NP or P

NP. This is a millani'm problem in mathematics.


The set o, all problems in NP, ,or hich the pol!nomial time red'ctions are not invented so ,ar
come 'nder NP Complete Problems. NP Complete problems are the hard$di,,ic'lt& problems in NP.
All NP complete problems are e.'all! di,,ic'lt. That is all NP Complete problems have the
propert! that, i, atleast one o, them has a pol!nomial time red'ction in P, then, all NP Complete
problems and hence all NP problems can be red'ced to that problem in P and can be solved in
pol!nomial time b! 'sing o'r deterministic machine.
All P problems are eas! problems.
The ,olloing to t!pes o, problems are considered as hard $di,,ic'lt& problems:
$i& The set o, all NP problems ,or hich pol!nomial time red'ctions are not !et invented.
$NP Complete&
$ii& The set o, all problems that can*t be solved even b! 'sing the non-deterministic machine
in pol!nomial time.
=


Figure 8!: Commonl" #elie$ed relationship among P
NP% NP-complete and NP-hard pro#lems
Note: A problem < is NP-complete i, and onl! i, < is NP-hard and <NP.
Coo&s theorem:
/tatement: Prove that 6/AT is NP Complete7. $or&
Prove that 6/AT is in P i,, NP3P7.
Proo,: /AT is NP Complete- means, /AT is the most di,,ic'lt $hard& problem in NP.
This is same as to sa! that,
". 9, /AT is eas! problem$ie. 9, /AT is in P&, then all problems in NP are also eas!
problems$P problems&.
#. 9, all NP problems are P problems$eas! problems&, then /AT is P problem$eas! problem&.
ie. /AT is in P i,, NP3P.

To prove cooks theorem, e have to prove,
$"& 9, /AT is in P then P3NP and
$#& 9, NP3P, then /AT is in P.
-e have alread! seen that satis,iabilit! $/AT & is in NP $see e%ample "".>&. /o, i, NP3P, then,
e can sa! that /AT is in P.4 $#& proved5
9, /AT is in P, then, an! NP problem can be red'ced to /AT problem and can be solved in
pol!nomial time b! 'sing o'r deterministic machine. /o, i, /AT is in P, then NP3P.
4$"& proved5


???The +nd???
@

Você também pode gostar