PAGE NO.
1
DATE:
Design f Analysis af Algoithm
Assignmenf No 2
Rouno
as Explaio the foOtwing ferms
a)
P- (elynamial)
problems thet can be saluedd in palynomial ime cwhich
meons Hhat the unning me df agorithrm thot solues
the prable m
is propor honal to some palynomiol hnchon
af theSize of inpu
example - Souhng sxching mahix mulkplicahon
B) NP- (aandekerminishic prbynomial)
orcblems thot con be verihed in polynomial hime
but theix Soluhons may naf be focnd in polynamial
time. These problems are saluable hy nandefminishc
|toxing machine in palynomial imewhich meons that
a Soluhon con be cheaked
in polynomlal time
eample - Traueling salesman Broblem
Subset sm problerm
lQNP complehe - (Nondelerminishe Palynamial compleke )
proble ms ore subset af NP problems. These are hardest
problems in Naheca use they are of least as herd as ony
ofher pxoblert:t NP JE any ene NP comple fe problems
|could be Soluctin polyhamial hme then all Np prablems
could be Solued in palynsmíol hine.
example - Boalean sahs£iabiliy problem f knopsack
problern
PAGE NO. 2
DATE:
NP-Hard
problems thal aye_at least as hard as the Ne complefe
problems but may not be in NP. This mcans_that they
Cannot be varifed in palynomial fime but they are
ol least as haxd to Solue as hardes{ prablems in NP.
exomple Halhng Prablern , Graph Isomaphism pzoblerm
aill Exploin Hamilkoniah (ircut Prablem with the help of an.
exOmple
The Homilkania h Cixcuit Prahlerm is clasic prablem
g
in fhe desígh onalycis ofalgarithms The prablerm
giuen graph coo fains
a
asks uhefhera Hamil tonian
ciYCUh
, a
uhichiS path thof sforts and ends_ af the
Same uexfex and passcs fhrdugh euery uerfex cxackly once
ax
example,consider ellewing graph
A
-- B
--C path of the greph
->
A B
E>Fc0A
D -- E -- F
One to
approach problem is to systemahcaliy
generake all possible pafh6 fhraugh the graph and
check cohether each one is a Hamíltonion_cixCuit, Hocuever
the nomber of poss ible paths gres uerg quLCkly as the
|Si2e of graph increaseS, making this approach.
imprachcal for lorge graphs.
PAGE NO.
DATE:
?
Q3whatis appraximohanalgorithm Explain
Traueling
Salesma problem 0sing appyoximahon algarithm
An appxoxima hon algarithm ype of algorithm
isa
o
used in compukeY Science Salue ophimizahon prablems
that ae difficutt or inposs ble to Salue.e These problems.
inuolue inding the bes passible soluhan to a problem
giuen Cex tuin constraints such as mininizing cuasts
or
maximizing efficieny
Approximahan alyoyithms are of£ken used in cal world
applicahens chere hading exact saluhon is ho kme
consuming or improchical
Tae qualiy of appoximohon alganifhm is measoed by iks.
approximo bon abo ahich
is
the aho of cost of the
Salaban pxaduced by algoithm to the cost of aphmel
Soluhon
PAGE No.
DATE:
exomple on hoa decision problem is
84Explain aith.
ldi£ferentfom an ceopkimiza hon prablem
>The main_differen between them
is
thota decisioO.
asks whether d while cn
Soluhon pxists
proble
asks fox the best saluhian
optimiza hon poblem
To
itlvshote the difference betcen decision and aphmizahan
-
problems lets considey tuo Pxamples
s a
|a) Decision Prohlem ir given list
of intege is there pair
up to 1o 2
of inkegexs in the list thot add a
to determine whethey solu hian
Ih this pyoblem the gool is
exists The aDS JeY could be "yes"
dY
"no"
Hhe ansaJeY cuould be Hes"
if the lisf is L35,1,1,7J
because 3t72 10
given d
list of intgers cwhat is the
6)Optimizd hon Broblem
in fhe list that ade up fo largest sum ?
pair integes
of
goal is fo find best Soluhon The answer
Tn thisproblemdhe
iS not
just yes" oY "no", but yaher specikt pair of a
intgers Ahat produes largest sm answey Guaold ke the paiY
i# the ist is l315,1.4?J, the
because they add up 16 which is the largest sum
(49)
PAGE NO.
DATE:
Qslwhalis Satisfiabiliy prablem ? a
The Satis Eiabilit prablem (sAT)is clasic problem
Hhe analysis af algithm - If is a decisisn problem that
asks cwhethey given Bocleon
a
formula con be Sahs lied
ox
nat. The sAT prablem has mang applica hons in
Campukr Scienceincluding hardware and soffware
erifica hon f aiJn hardoware f software uerihcohan the
SAT prablem is uscd to check whether a giuen desigh
oY progam sahs he S a set cf constrafnts or Yequirenm
ens Jn other wards SAT is the problem of dekmining
iE there exists an inkrpreto hon that sohshies a giuen
boolean formulaL, it esto blishes whethey the variobles
of giuen baelean formula can be assigned in such
a
way as fo make the foxmula euoluae to true.