0% found this document useful (0 votes)
50 views14 pages

Adobe Scan 23 Dec 2022

1) Dynamic programming and memoization can be used to optimize solutions to problems with repeated subproblems. 2) Dynamic programming breaks problems into subproblems, solves each subproblem once, and stores the solutions to reuse. 3) The knapsack problem can be solved using dynamic programming in polynomial time complexity.

Uploaded by

Aman Rathour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views14 pages

Adobe Scan 23 Dec 2022

1) Dynamic programming and memoization can be used to optimize solutions to problems with repeated subproblems. 2) Dynamic programming breaks problems into subproblems, solves each subproblem once, and stores the solutions to reuse. 3) The knapsack problem can be solved using dynamic programming in polynomial time complexity.

Uploaded by

Aman Rathour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

BL20223S00o3St

21BCE1284 (man Rautwo uL)


CSE3004 DeS ig Awauyeiz o
HgontHim

DamuC Pro frammu na s Mounly an


oPHnmuzatiOn O VeAplain reursm
WheiVO w e see a TeCnsive2
SoluiOn tnat a s Yepe ated Calls
fA Cam Puts, we Can dptimize
i6woig dy namac Pa0gYammirg
Lt g doveloped b Rchamd Bell
Man n
b s iCay i t Ued to Solve L
| wnstao_oh mz aHion PaobRem
in wich dyna mic Meang re ferena
to Hn aMd Po rammun meang
Ylanw ng tob wliution

L+ PassegstwO Importonteleme n
W ch a as iveh!
DD 9vontappina Sub PAoblem ?
FLR G P0blom whee_
+wG 2hmose P o blo ng shal
he Same e a Qwdl Con not be
reateddis Hmcyo incepeh
Spiral
30 Date..

basicoU thee two uOug


foo hand ung hel:OveAloppi
Sub p0bLems
a op edown apPooach
A A Pob om úbroken into Sub
PeobRom and these Subpsoblem
0 So\ved and he Soluio hs
o remembeed. în lase if ho
aFo be Solved tm futwne whu'
cn
mea nS n a t He Voulues CL Stove
docta Stsutue, whncn
heP o to O ACh aom-
HHueki\y whon Hhe S ame prob|em
wi OccL dwu he POuram
exeutHn
D) Ottom wP aPPsoooh
Lt te med a9+0bulatimehngo.
Ln Swbyo b e m8 ae
ded to be Solved in Ouolvanco
and he Wsed to bu l
C SolutiO to te la ge

GPtimal S StructwL-The optimd


9oluti ono heOvocuUPob Jo COM
he Congtu ted0rom o PHml
Date.

o lutOns to u Sub po b lema

matricg size X2 28 4, x2
Ond2 x3, Hae m orix m m2

20
In tus Corge, +he (ea0t
multt-
Catim nd Opim al Segunces
mc ri A2) (2X

hswOudd ber epsog ented by te


hN rouah m thot Oe
Yom top e corlto
COSho

me nw munm van

Spiral
pil

Date....

OTime comple XI fy olefihed as the


QmounteHietken b n
akgooth m guh,as a funcHon a
the lengh_Ch he input
Lt me 03UNL he Hme tq Len tP_
xeut eah Stcment ok
In gn lgorithm
he
Dt uu not 9aing to examine
total exectHm Hme c{ an algorthm.
KaTha, ut u i n to v e infoM-1
Ltom_O0b u the V0i Oti N (ncreage
Os decrease) in exeution Hmne
whRnth humbea eope rajiOng
imcreage ay decy ecae) in Cn
ala oTIfhm
e as Hhe amountt e ime faken
s un Ction C Aength oIPu?
Only

ut Stast by 0senvihg hat:


A 19naua L us deciola by ln
oLgoni thm A EA ntar tg
A-4 and EL A(x)=o

Spiral
Date..

A ana uae L belOngs to NP 1E Qnd


ony If here eust O too-tput
Poly hom c l 1 e Olgorithm A and
OCOhsta C Such h a t

l=szeSo,2 thee exist a


C ifiCat wfth IH=)9uch
hat A(x,)=12
FO0 i s beVOtion we Con see
hot tor 0ach languaR Lin NP,
heha ig Cn Al2onHhnm A tat Can
Ve eah jtem_X un Lm
Poly nomual ime 4ven a Cati PiCat
y wi
wit na

Te died if aAven E 0,1* J


Cnt ven nguaGL NP
c o deteie hee a
t i t coau
CLa tha ccep Hg al arithm
A Can
TOduciou if Such uti tCole eu gt
we ee cd +e y a ascb.a y
o 2k wh I = 0| and

Spiral
Date...

Atte2 eyoluc i wa all 0g3SIbo


:Cer tH Co twtth A (X) uwe Ca
detes mi na for SueiE theu exuSt
CtifA CoU o which AMA
1 forte en
Hena,thwe eust: an Alo: ho
Oecos Q language in_NP (2
Ut wth K Congtant.
F A Venlanguae L and t
OcLpHNG A_hig alGO: Al cooke
uS

AE 4er each y6 0,1


with ly|= ol
,

f A =1)hern retign

Sairal
Date..

Let13 Sa we 9 G Ve a St
and d Patt ernStri hg P and
tve uwdrnt to tocau ta gtTig
PbeinS_ end in String T
nu h length OString T
nd m u en g th CSiring P
hen bru f0Tce StringmtchNg
WIIL C03t OCmn) sun Hme becauoe
we Ce COns ideung even_ in dex
romO to n-m t3 Stati ho
molkx Sear ching On oth
hand, Lnuth morrisPrat (kMP)
String matchi ng agor uns in_
O (mtn) Hme to Hnda ecUhertou
patt
pat esn P_inS D
LMP culgs, a ep@CSSing u
olone n Paitean Sring P and an
CYY CU O lengm m Calcuated
One b ore upto m Choua tog.
The oASt Cose Comleu ty of the
Nahve 0ge us m(n-m+))
thei me Com plexito kMP algo
O ( n ) t'n wass Canst. The
N oivePatan SoaLOivg aLAO
cloo n t weik wet In Caeg whe
W_SL many motchi ng OoAQtesg
foloue d by i smateMng characky

Spiral
Date..

he Ncutive Patte9n Secuciug algoi


doegnlt u03P weu i CauAe uh0
we Soe ma mot ching cauaLles
folloued b mts matrhn
Ch cuaUe
x t EJ= AAAAAAA A AAAAB
p c J= AAAAB

The LmP m ctchi hg alg0 Tithm gea


Ceerorating Paopeti Patt ehh_
Sub-patt a3 n3
h w [ h a s a mm
e
o t han once
he pabten) h e pot esn and
o S t Cos e Comple

H
COm p R
t with Pcct
AAA AAb A A A BA
AAAA CInta)
moctchTusuig CQm
LeAnd a
N at| Ve Strng mot chngr.
eg

weCompanene
En n Xt StP
wIndo 2 t x t u Ih_pate

ytt AAA AR BA AABA


Pcu AAAA' PauteR h s hifte.d

Spiral
Date. *******

u whee KMP doeg 0pH mu zatn


o VO Naive_
h secomd imdou, we ComA
outh_A C_patten wi th fouta
C r re Wlnda
t t+ oleid whet he

inu,
O nou 1SE thee charados
wi anuway Ctch uwe sLped
t ch ug r s t hG nonac
Se CnUW MosTis PaH) atm

A A Huffmgnn Code e d to 2
Tepses ent tue ch aiat egg-
ySiug freque nia iven in queste
u tmann tre2 Can be

Spinal
O
Date...

Co do
1i110BO
1I:11

WIhg Poe f , Watching, gtring


Can e cecomm pse d a
1 O

L L La ie
thee u s t Potynomiou-tme
COmput ab e yédu ctiom unCio re

Such hak

Sarat
Date.

Define f-ff2) then


L w CPolyhomu a-Hme
Compu oub Re fun th or' S1,*> o,l
and
xEL f3() E La
ho lds
Mend
LEP

Sairat
Date..

P. NP and NPC are Clag ses


Yfobtens W '
CPmptotional
.o
C olvIng a ven PAoblenm
A Pho blem J Saud to b e 1
Cas s P I It Con be Solved t2
Po I no mu c HmQ mea hs
Co mpleuty o Soluti m uo

A Paobla m u Sauod to be in claas


NPC. C non dofes mu nu'stic Polynom

bo thhim h e e a s S NP Qnd
N - Maad, nmea h3 h a t u ug
the

A b m w gdd te be im las
N? CmOn e i nSH Potynonwal
H a n a n be VcHe9
i n Po nou ima
INO, 0 Wa sa0 pooblem Qnd
h ven dy,naL mi C PAeramn9

Sptral
Date..

The ol nap saa Pho bLe m us a


NP- hand Paobkom.
wel Lnow
meahg that c U Orleat
hech
G3 dUi HCulr_C e hon dust
P&0 blem im NP:

Hou e ve, Hhe mven dynamic


PApgra mmung2
wdo a meCoMp louty
nN) aich us polnontia
Hm CompRe xIH
he dna ue }fO9 ra Mw
f o taL LL Lnapsa k
YAob le m Us C olynomal Ham
CLgoifhm Cnd tHa Knap
Knap.sec__
Pob.lorm s i m tho CsS P

Spinal

You might also like