Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

It is the hand written notebook of notes of dynamic programming that help to learn., Schemes and Mind Maps of Network Programming

An introduction to dynamic programming and the knapsack problem. It explains the concept of memoization and provides code examples for both recursive and bottom-up approaches. The document also covers variations of the knapsack problem, including the unbounded knapsack and the bounded knapsack. Additionally, it discusses the subset sum problem and provides code examples for finding the minimum difference between subsets. suitable for students studying computer science or related fields.

Typology: Schemes and Mind Maps

2021/2022

Available from 03/10/2023

52-rohit-it
52-rohit-it 🇮🇳

1 document

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Deepak.
Marglon-
Date......***
Dynamic0unmina
Page..
******************
DP
Enh
once.d
Ketunsíon
hen
apbly
DP-
Choices
i)
phma
(2
on
mone)
Note
Note
Newstant
qfoluing
Dp_p10blarna
dimctl
y
makng
table U (Gahn-
Uh
Manner
Ho
tg
tant
Wilin
QP
Code
hesi
K
ppnaachz
Memoiz
aHon
Bottom-Dp_(9abulahon
Tle
pak_Mangani
O:
Kaapsack
i)nbaunded
Knalosack-
di
9ibonacci
LCS
(y
1L3
LiKadone's
Algnithn
ijMatnix hai
Mulkiplicahon
Tanant
Panblonna.
i
DP
eh
anid
Othena
pf3
pf4
pf5
pf8
pf9
pfd
pfe
pff
pf12

Partial preview of the text

Download It is the hand written notebook of notes of dynamic programming that help to learn. and more Schemes and Mind Maps Network Programming in PDF only on Docsity!

Deepak. Marglon-

Date......***

Dynamic0unmina

Page.. ******************

DP Enh

once.d (^) Ketunsíon

hen apbly DP-

Choices i) phma (2 on mone)

Note Note

Newstant qfoluing (^) Dp_p10blarna (^) dimctl

y makng table U(Gahn- Uh Manner

Ho (^) tg (^) tant (^) Wilin (^) QP (^) Code

hesi K ppnaachz

Memoiz aHon

Bottom-Dp_(9abulahon

Tle pak_Mangani

O: Kaapsack

i)nbaunded Knalosack-

di 9ibonacci

LCS

(y 1L

LiKadone's Algnithn

ijMatnix hai Mulkiplicahon

Tanant Panblonna.

i DP eh anid

Othena

ate..********** Page.********. Knap Sock_ Paoblan

hat Knapsack

Knalp.sa.ck (^) a kindobag^

hich

maxinum

0e ha

to qstong^ ha^

items

no

ohnapsath

hnapsack

nachona

O

Unbouncded.

achon a KNajhsack

,

Iaa gneody^ pnoblen^ in^

udhich, p^ nee.d

QSono aMaMumvallsaeighf^ into

Can (^) g$torn

anHemb Cuhn

O11 Knapsack

Tn tho bnoblom e

e.ithe nc lud! an ikom_into hL

bag Jst_exclude it

ung d in thsa

Uabounded E4 ane 0a 011 butL

hau n

i) ban^ Condihon^

-hink e^ the^

smalat valid^ a

înbut

n

hapablemit will^ he^

when "oe.

hanean empta

anna

i

he

ba

Choice Diag nom

pn on^ element^ tem

Val

wok

Wtiiw ttis

he Maxim um of

in he

hdo ChoiceS abo

left Subtn 11 bpO

GnSLen

Tt ConL (^) be snimh nht ubte


Page.. ****************

Hecuive Coda

atKnap sack (^) Cint

ot 1,at valta, (^) nt (^) w, (^) intn) tefit )

ifn= o 1| W=0ne kwn 0,

if wt[h-11< W)

hetun _maxalin-11+ krapsack wt vayw-wtni

else ifat [n-1 )W

etun Kaaksackwt,val, W,n:1)

Date...************ Pa ragea*nseee**************

abulaion Code. (Bottom Dp Codle :

hebaaic iclea Behind abuleHon e

1Cuaive Calls _fhat Ae_hanl

oSeenin he Memoitation techniauo inle

ternah onm

abulaion_can be pn sonmed to Hhe plowina

hoo steps

Tnitializahion

boical hse

Chanyging heunaine suntions

in itenahue one.

an

y0Cunaiàn

ntdh [n1i1[wt1,

iiq lisation

Hon int i=0.ien+1 itt)

fonintjz0,<w41,jt)

dp CiC{) 0

7Ttenative Veròn

ton (int^ izL^ kn+1^ itt

oninfJEljsw+ljtt a

Ewt i114 Wj)

dpilLEmadpLAIj-wtL-1tvel li,

ap[i11LIN3-

el5dp £13C] dpri-1Ejat

Netunn dCnItW

Date.******* Page...*** g

Intnoducion evision e knagbsackad

A

voniaions unhn_pnoblor

iO

Tdoni

a (^) a

problemin dh^ cap

DePnluedwin Knapsack_

e e haug

Whn e^ gee^

a_lonn hene

Capacty and

ha

aßaciyaith opmal^ banti

noblem

an itema hat

Vlls unden Knapsack.

hapben that

1athonhen

oimeime his

towtL1 ovalc^

hon 22

h yaluo

anc conaicton nglecE oeiht

Lzample.

athnn)-

ono aCon.stnain^

aA W

alu MOne hat

Choices

that we_cnE taKe

Ow anS

ndthine _ala e the change in

the nfhalizatini^ in^ is^ vmiaio

Date..**********Page..*.

Cad Vasiationd

ThihalisaHon

a1ags11e dOmmorpn^

d_Surn i^ O

possible le^ ei^

bun_

always

essible empp^

ubse

Hes it

dum gntaken^

hai 0

emmpty^ is^

it

bossibleto

AetSn?

NO.

DO e^ 9ot^ Oun^

initialisaton

dpCat11T Sumt1),

on int i =0; i<htl;_itt)

foninlj0,j4 Sumt|JH)

f (i=z0) dprillil

g0) dpGtjiz tnu

Liy Main^ Colo^

wEr

W Sun

int ax^

nof 0/P

oubiC Vaniq hon

Date.. ***** ****** Page.

nopunla os e^

ernofunchonin (^) bolesn O Le usl ) onuiton

dpti3t (^) =(dÞtiJ Li- (^) anm[i-13] (^) dpti-11Cj

else

dpriir (^) dpL1:19 i

han

Desak anso

Mekutn elp[n1LSuml

Egua (^) unanhihian

Problern

G en an atauy Can0e_onnHhon i in e

to qubseb Such^ hat

lemont and u itin hifhaae_

qubs.ek e i ak ecual sun in heul

9u h 6e6.

Op Tiue^ nce^ S,

Op alse

Date.... Page....

Codo

hool (^) Eual (^) Sun Panlnl anL1, înt nintsu

Sum , 2)nehan false z-

i

MetounSubset Sun int annLI,intnint 5un

oun phubset pun 1lfha iiven u

roblem

ind lun ftad^ ho:

an_passf hle.

Giuen

man (^) oub.Ses inon

X bi

TP 23,S, 8,

10

Eplaakon S5 2,

Pagt*********

2ilarity

wih pubset^

oSun (^) i

noubsetoumnobem^

1 ny^

ne

outu Aubsef^

o un

possible 1 not

But

home_,in thio^ roblom^

de

alse (^) niecl

Couni0 the ubset

Code Votiahon

Tashaisaion

for int i0 iknrlÍtt

son[int jznjkSmtj

i=O.) dpti1Lj1= 0.

dpi1j

MainCede

fo11Li:11 )Su dpriCj1-dpti

else dp1cj1: deri-11rj-amti-11] tdli

Cun

bo

p1oued

eaailSince,

StS 2

Sum ann

finc

out the diftenc

Coun

giuenlann-S)-8, dift

"

di ounlana-2x51H

int lh[nt

11LSum^

t41,

4onlint izD10t11, it

pindj-0,jK[untiJt

iffiszo d6rirj1=nlsa

ifljz-o

dpri gI=tnul

fonint i2^ Kht^

tt

onintj j{Suntljt)

ifannfi-11 < Sum

dpi11j1dpt:21j-dnoLi-13]dpli-

else

Dat*******************| Page...

fon (^) inki Sum 2 iz0,i

diE Sun- 2

xi

bneak

Aetunn dif

lv) Cbunthe numben o

pubset_wih

nlon

aien anainaoncidifleninca betoe.en fhe

0Subset Sum CAuNt

Subsek ilh Tha dtewnce

Ex

1/P o1,4,2,

Explan ahioniL2nd3 L22nd

71ands