Unit - 1 DAA
Unit - 1 DAA
sheet
enbeas.
esoyy prce agond sol equanhtatie laulitahver
athat isgdsal
A geud saltion is economcal in dhe use a
Agaud sal posseICI
dhe hllo. qualihe CopabLhei
Sinptyet poutirld gençal sal"
carily indeatd athes, eariy mocbed
’Corek Iulh, eLon uanicalin the se conpteo tme,
Computer stox age &peritheralt
’Dacamcaded, sawth kers oepandences on au paihtax
hiw or iepantabiity
Sub-pcedures, n pateh-wtnk sal"
’Quahtitate measuer asc woluable as hy
proide a way cf lirecty ptoliching ealuahng
Def"
The hai fol Oglal) ifk positive contont
suth dhat fn)<c*gln) tt n,ne,c)02D
ntiat
F(n) 2nt3
he can wgite hee
2nt3 5n if n>i
fon)
fon) =O(6)
Anethe _mcthud to go gagkt side slh is
So Ca s om be
1occ bamd
<a23..n
bond per boua d
Say
n)= 2n 43
2n+3 < we cam wite anthin hoe
which satuy he (onelihon.
2nt31n
fln2n43
1n2nt3 5* n
)Lincor teasih
So hme ta ken is
not care time is ne
|0 +20tr+ 30 1
23<|
Hen cost
-6ch t i e it
0 nitt t atceotI
Anethe
1 Arr ay
7
coS) cOJ
hletceyt
1
3*(2N+2-1)= 3(4N- 1)
- 1N (onsolilat
2 2
Alyelhm
p[913)2S6la|F)2l
mid (Uth)l2
(3,S2.3)
S8 herst (wod, h)
(30)
erge U, mid h)
ChËechve
ony ho shuw elahon bet" orpenanhalpstlemt
ieif one enpancntial prub. sareothen e
say ather fyplfnb can be Salved ig
Same wey
?)I yauane mabl to wmde dots nioitbe otea.
aly f dhenid cpeloiaf tine erdekt
P Hord Nlongkde
on aAentaA time
poneniat Tine
i> Lincax Scas ch o )
22 imay Seavch oleg)) 2) hading Salemo
) nsebon sot lon)) 3) &roph Colauing 2h
42 Meje sot Cookm ) 1) snDo -Ku
)6inay och (otlgn) s2 heduling
19 take Ol2")hne
JL avd to check sdd
failue(), 3 <
Division. Date.
5 6 7 8 10
Question No. 2 3
Marks
NpHasd
Reducban Crppr.
Redachss i ueed to show aeloaior bedi satishchliayt
elatonbet? enpp pb
nced some base problen.
sa bese we lake sahitiabliy obles'as bauc
CEh l a icalled
it calleaos Bu sihenal aleuler faxaala.
CNE Satihablity p.in a bebley tetishabtbypol,
where e Beolean drnla ispecihed in cNE.
NE =(oyVi, Vo)A(,vagvi,)
clause
Sothe satishabitiy prob i fr ahitk
e total Ppoibiditie
take,ie. tztalfualie s
23-p for niableu
9h 1
saowT vanabler r ,
Same state saCe eecan
wls, 4,33
Sane as aboe.
St,Jhe way ur than cdetion bd satishabË he,
sotithabi l,
Paloma hiae
Satirhiobility d o1kmapratk Ep
nstane
t mean,i u e intdan ce4 od sahibobilty
Satiikably
NPHard
By tansi he propet
NPMad Def"
A probk is NP Hard i£ erey plkn
in NP can be pa lynumicaly educe to id.
Har d
Rediceyno
ime.
mkte
Had
any problens 1 is
elatdho sotisbabiliy,then prob. is NP-Hend
14 weo wnte non-oletmniuhe lgon
poly ime, dhen prok it Ne-Conylete.
S a
Ci fu in derm cquadin o inequdlity Jhad describer
of/od ids wdlcon Srnaler input
Reurnce Relotian: e-
H euoence
equatioM that dehnstlotion tor a sequene is
terms. the restnd tem b,
user prtau
lurire Calr.
Lt uses T) to shw
dime daken
) Binagy
byninpuh.
en
Seoo th
aoray hvul bein
Key=x
Bs (aj,)
mid(ij))2
LE ==Camid) )ikey
OCoie (onstaut 30,40
else
if Calmid)) 1t our eg" i T() hen
Bs (a,i, mid i, n)
else
Bsla,midt&, j Cistauthe
tnine d
- Node Consdant
Te)
ahne me Can wnde ar a C'ar1.
2) Tecs f n3
To) Void est (oind n) lere 3he Test (3)
i (n>o) fpsinhiny value Rit
luhich dake foi!
Tet (2)
7(h-1) Test (n-1) Jie.3 Tect
Testo)
X
Solutiom,
To)
ucn) deponlr on hn)
ha)fu)
Case O(n)
0(1)
Cose 3
Eg ) T ) = (n1) +1
Sot Hene
=n°Cun)7 hl
fnn2
n
Case2.
pel"dable beth hn) am), caa
n i c Ol4)
3)
Sol"
TOn) nu(n7
(ale
hen)
n no we canunt
-
(ondie
T(w)
323
|2*4+6e+4 <7*4
Here -4,n)=nfr
So lond and
Vale doesnt att.
so her e
Jen)-o(nforc:9,n,721
R so
fu)
Ansi
at
both sides ad n )
E11n3 for al no d
Leln)2nhnt 5
11 9 3
2 29 24 32
3. 54
71 81
129 192 2Sb )
2s 341 500
Fom dable, e
JE Cz3, no3 hen fn)kcxgen)e
2344nt5k3n°t'0(n)i hue
So,thet can be such mmul hiolepair ot (Cne
fo) 0gln) =o (n) toy C= 3, noz3
fn) =0yln) = o(n) for C=4, no2 2 2seon:
h-om all dhesC, we can Say that censtant ccan
c
be Changed but (glr)) shod be same