Escolar Documentos
Profissional Documentos
Cultura Documentos
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 <