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

Algorithm and Design Complete Notes, Study notes of Design and Analysis of Algorithms

Here the pdf contains Algorithm and Design Complete Notes for engineering student , MCA , BCA students.

Typology: Study notes

2024/2025

Available from 04/22/2025

rik-saha
rik-saha 🇮🇳

5 documents

1 / 51

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33

Partial preview of the text

Download Algorithm and Design Complete Notes and more Study notes Design and Analysis of Algorithms in PDF only on Docsity!

Flow Network #iMuast « have 1a; Sowa Node ema. ia Sink mode kay A Hort be a ditweted qth m4 . Sa, # Nust be hei ghited ae : + Weiakts must ibe ‘hon + regarine 4 maotve mayors the, dinect” @ Flow’ netwonk iA a, dinected ee thot iA Wied to Todt motetial flow oid ip " pounce which @ Thu aw , Wo distin uiahed Vertice® , One q parte and the othen | one Prodan mateniat Yat some ‘pte ip BmK rods Which co naumes materia ab Acme _ fonetant mae 6 Hactumetie a Blow network eon “he defined abe oO qrerh. Glv,E) Whee Vin the Det aten an Ein te, Att of ede “Bt. u @y. bow : (unee , “franta @AVst a Ten- nagative p2i ae denoted "4 eUvy70 (6) Tho are tws ; dintinguiahed hod Ponta Pounce Cmal ke Aink dancrhea by s pal ‘pr especttvely . () Fon “t. yerten Vv eV the in a re from S! to .. T' Ty, coring v A A tw in Gr if a Tet vobusa fencter gl yxw LR Ast. the Following cont tnaints hedel —— “ Caracity eontraint —, (ay) € E , £(u,v) BK Cy) ©) Skye Sxprrectry 5 ¥ayek ,FGwe - + Cu) () Flow Commivation—> Net inflor = Net outflow , (Net inflow - Net outfioo = '0) 2 , T4(uy) - Fun) = 0 wey vey Mo Flow Tt is dsfinect Gh max Around of Flow rat the veto onk Would altkow te flow -fnom Source: qo Bink Fond - Ful kowon Al gonithm } rtd Algonithen T+ dimonsinates ater by Btep Proceduxe te caleutate mon flow ef a netwonk This ov war intmeduceet by L.R Fora © D-R Futkoam dn 195 : Input: Source (8), Sink (1), Grraph Gy, coracity cay Some Terminelogion qulated iow netwonk 0) Pugmenting Path — Sim ple poth rom ounce to Aink ony ral Laos Poss fRrtou gh @) Residuat Network Graph (RNG) > TE ino qrer> thet indiawtes how much mone Flows abtoned a each ety of a network Gi) Bottleneck —7 Mirirnurrm Capacity of om Peagretg Ph oer 3 5 Augmenting Poth. GO- A- D-B-T BN: 3 Gem Flow = $+ 3 > I) RNA Step A oe ip) not Tacha be Pugrnanting Path : S-A-BTT eo BN. 3 Flow = 11 +3 = 1/4 RNG No mone Meachob Path after thin} Hon +low 7 ‘if Pagmerting Paik — Botieheek— o-p- B-e-T.. 5 = ; RB Hex W S$-¢e- 7 P&G | ™ 9 -&-D-T 3 () 6-B-D-@-T. 20 | she AP: S-¢@-T BN: 6 Flow = © + G =6G RNG G 5 1) + = AP: 0-2-4-5 Bn. 2) Flee 2 Wait aoe RNG — AP: o0- 2-1- 3-35 BN. 2 Elon = 2ga+1 = 23 CIN, NL Har- flow = (=) te =—_ Function : Fond Ful ker a0n (Guaph Gi, Node .%, Nod T): “mitiatize flow im at edgts 0 While (there aniast an augmenting Path (P) betwan 4 ama T im a Tesidual netwonk gran), Himsida while Puqment Flow ortween ‘9! 4, ‘T along Patt p' Update TUriduak Netwonk qrarh yutww Parucdoe ode of Aug menting pesth augment G¢, P) Let b= bottleNeck (P,f): ton cack edge (uv) € P , it e@= (av) in a fonwand: edge. then incuare $(e) in G by b ele (ay) is a bac kwored edge. wand fet @= 7) drown f@) in Gh. by 6 end if ° end fon Rew (4) | Time Complexrty = O¢eE * F) Minimum Cut. (Hin- eat) Aa Gt TA ow Ae of eA oer Whore tumaval vides A... COmnected qnarh mtd two diAloin Arts és. i a PP CUt ney = {G2 G6 Catt Vode = 41(,3) MSH ig » eG 4244 Set | = (4 f5t The Yninimum cut of a Woeigated maph @an be defined ax yy inimum Alm of Wei ater fo As 4Bok pohen Tumoveed 4rtorn the me it divides. the qrarh lito too did oFmd pete SE Hin owt nat = §¢0,3) 6 ,2)66,OF | Hin cut Value => wl3) + WS) +WGa = 14 Hin- eu net = FG, Ce,F)T Hin out com = (a,b) +h (EP = 2+3 = 5 Augmenting path Bottlensc x ff f B-A-D-F ; 2 B-A- E-F 3 B-A-¢~E-F 3 B-¢-E-F 3 ote P2 ee tr Ap: B-A-D-F BN: 2 Flow: 3+2 =5 RNG ey a Ne 6 Pugrenting path —-_Botlentok b-1 = 3-5 i o0-2- 4-5 4° oe 2243-5 + Oa se PHiZ-5 | i Lemma tuwlated tv man flow min- curt : Lemma $e: Let be 6-1 #low , then VG) = V@yre vay . when « (A,B) ip fap ache <4 ut Lemna EE! Let # be ay S-T Flow, fn VE) = VO™ vie Lemme Ss LAF be amy ST Hlow amd (A,B) omy eat at fy 4 ‘ } ” v@) < cs) Lemma 4-9: T4 Fis a S-T Flow At. tho tnist no S-T Pit me RNG in GU) ten thee 1% ST out (AY BY) in the low netwonk fon which v(t) = cut (AX, 8") a Llo- acm Lemma 4-0. Th How 4 metuin by Fand= Fite . Algor 1p always man - flow Lemma-t-ll? Givan.a flow $ mor Value , We Com Compute an $-T" = uit of mm capacity in O(n) time complexity Lemma $12: In ev iow netvsorrg Re He tlow.4: emmys amd cut.(A,8) ‘bo that VCE) = cut (A: 8) | Lemma cane Tn avery Low wetoonk the man. ‘vou af a %-T flow. is equat te min capacity Q-T or | Lemma _#- [4 : TE ost ea pac: in the flow nekoonk ane, integers fim tow 1b a mon flow f fon whieh at | flow Value FQ): tis abso * om’ instegae : Arelication of Flow netwonk Bipothte Gecaph A Biparrtrte maph iA a gqnaPh whore Verte2% ean be divided ivrto ri di jointed inckependent Act (U,V) arf, cm eclag (uv) eittet eonnect vertiegs UV on V—yy NHoximom Bipantite Matehing . In om quer undirected graph’ G= (v,£) a matebin iA. a. AubAt of edges a m CE st. fon avt vot UEV A matched ba . ( en3 Our dim to mMarinum eardmatrty oF m O% much ah Pons i ble : . : wd I. Thin Problem aan be tueduced into g man flow Problem ard by oPP ing Fora - Futiws on Algonithm Wwe cam find maximum ree i) a) 3 & i oR 2 a 4 = d), (Tay, E>} vo Match Set 4(P/8) (ay, (R, t G NP and, Com putrtiona? Drtnactbilrty Complex Glass Thu existh Aome Problem, bard on tin Aolabilty Problems, can be divided inte diffownt Acts on Can, Known o> Comflenity “alas EH in a branch of Pum of Comartation het dyabs With He mepourees -to Aolve the Problem Thou we paiealdy 4- aie it Com Peary Claxryeg —___ WY Pp clan, (Wy NP elas a Bee 5 (i) NP hand claws Decision Problems — ivy NP complete claw “f bine Problem Ft Yer n No P Comm Plenty Class. The Pp: p comin Class astonds ton Dina bard > Tb & the collection a ducinion problem (soba? is “my 44 on mo) that tom be Aolved »y “datemminixtie Machine Dy Polynom iat Hime. + Some eats a P- comflenity cls Problems axe ay ean sto fing the Aolut” sf i Prick lems oot! rctibte NP complete: | Complenity alaw: fh Problem iNP--Complete. fp i both NP hard & NP “Tn other word we cam a ne _ conn hete Paotens « au oy Problem “of NP alow Soma feat of NP‘ domplete elas problem, ate — “> NP aomplete clas problem can be ned to Np Problem ™ Pola nomiat time io 7 TE NP Complete problem im Aoivable in Pell memic +i flan NP iA abso Aolvable in poly momias tims m SF Hamittoniam CHolk, Varites coven , Sais tiability Mobler Problem Rechue-tion ——— Problem Reduction 1 om abit design fecholgus that totes O.. Gommptete aompler: Problem. a. Mpa amd Teducer JH he 3 Almplen oe Te Simpler problem, is ten Aclved ama the. Soliton it cam be converted to get the Aolut of onigiral hand, Problem Hattemactic (et Xo iacca problem thich ean be Salveet Mm. 1 tims,.and “Vis amotio Problem, Which js as hand ax x Lemma $-] Th X. com bt solved im Palynomiak time thm Y con alo’ be Aolved in asters time ‘ Y< PX he. Yin ‘Pobypomit time rideabit. + to x Lemma, $-2 Roconding tp Lemmo 6:1 JF TY eannct be solved im Poly nom! time fhen A cannot be Aolved in pelly nomic Thane GN Tite tyre 4 teduetion . Problems — | Cy Simpha Reduction Problems: Bi partite Matching te Flow .nttwonk LeH +> Ged Tdiiction | Globes pain te Aont quduction () Len £ PGeDd Algenithm— ben Oy) iR(y dx) o> Swap X% 64 fom i<- [0 _ | Ref (x7. i.) | Let. the | +o find ‘LOM te “Teckiniqu” poh’ Les Sean reduced and time. coment 4 Ged et than om _compl 4 L@M eps on The Tediicchon onrthm 14 LeM (x, q): LeHe X*Y Gep (KY) 1h x ia divisibe ot he iven; “Problem th 48° fird *LeH di Harel" iRaainction ‘robles: aa Trdapendert net Vortex Coven ‘Tuduction Jus Convan Hass frioblam poi 9 Hamittonian ex ele. fo ns Oe TSP. TUduc tig Travelting Solve’ Problern D> Vertex Coven ty 904 Coven reduction ? 3 SAT to Ide Pendant ; Akt | reduction 7 Cittenit Satis fiabilty Problem Gens, >: - iF (x <0): Tun / Retin 2 ae yin sy gt of! too nimbov, X ama Y the mith 18) “abeve’: and «Time compa ity. Oty) we cone fatten: Moducd the: time --cownplert b ‘pivople quduetion or) ’b ml oh xT acd LCH'= any