You are on page 1of 53
ARYA Institute of Engineering & Technology, Ja Department of Computer Science & Engineering” | | ! i ‘Ns | Notes: Unit-1: Introduction & Divide and Cong Methods ON ARYA GROUP OF COLLEGES AleT (1) acerc() aletm() acp () apcc CD) Branch / Faculty: Topi Buble Sov 4 - es Sten. Re : a | ps Ss Soy_T=\ tn-1 | Step%. Repent Step 4 for Ie O to n=-Tod NS Steph. 3¢ ATT) > ALTA 1 then! {nAexchange ALIA omd ALA+\\ Urwo o Aereparraryys Vastia\ te pes Ts Lary whic Ate) AL) Are) Aps) ALY] forxd-(1) : ca)__comPore A Fe} ana ALI] a 9533, interchawge Ae) and ALA Omg nea Ose AL | 4.285 at, 130,17 (b> Compose AIT omd ALZ) (25<41) | No Change ce) 6 ana A <\30 o_Chan ne C25. Compare ALB) owl ACY OS Boris. sp anvherchonoe. ee array 4 2 Sy UL LS ID Loses Newest Ld at bottor Nameot Lecturer OY THE OTS abfer Hirst Panes be Pars coy (SlesT rifts |e] “Fra REG Tid ess AED {a5 Compal AL? ANpOPaS— ! - No_Ghawge : obo) Compute | : 12 L he f HEot pel L B : a i L \ ESvA \ > oo 44 cri in AIRY_A. GROouP OF COLLEGES aAleT() AceRCC) ateTmC) ace) apcc Branch / Faculty: A xO. i= x0 n= | Steps . Set mins ACT ana set Mooi Stepuy Repeat Step foc {= (+) to N-1 [steps 39 mim > ALS] nen eSee Mims AL II \ he PT Ae Aomd Ext. ay. f= [es] 022] Bolu] if ATS] ALM Ar Ars) Alu Pord-3, te L jek myn = ASo} =6s- se @ 6 paxe__¢_ Min Ari) ie £599 } Se Seb mins 46 docs | S-2{(b> Campore ( Min> Area) te. SO2I2 ek im = 22 foce 2 S3(c > Cowpare ¢ mn yAGSI . 995 ee ee ee Name of Lecuror [eo Jaz. =m es ALY = Bolt ! 4 of phe Ghee. fina aWerr Shevrert ‘Pn crest y=zfay orrpane ¢ min Ape te ph Ai0_C\nenn tye \ Waa tte acts 3 Levigiety FO | ; Fo a Compore {rad Ags) Ao as Ne et 4 - nancag., comin > ALY) i Taucs compos 1 1 X “3 AIRWY_A GROUP OF COLLEGES AleT() AceRc() AIETMC) AcP () apcc C) Kee ACA wsert ALJT yn meted Sequence AL | --- jst] f= \-1 conte Ci © md ALT Key) AL¢+i} = apt) C=it-\ ALA] okey g eg _A- | 8JTé[ sJo Taishi 3s) Namo of Lechner Aa RW A. GROUP OF COLLEGES AIET () ACERCC AeTHC) ACP) Arac C) on Set S ep elementh , Cach anmrociads Se Srawecty ss sven y ba | ih Visssheop Sine! CA) oma API > ATET) : ae Qus = ieC c= heap sigecA) Ord ALY] > AL lavgey}) LE_Daregent ie! Co mitertoeveritajd iC 9 ] Peon (Ueto: wretumna nase ot nele?S poscenk e shetie y= 26 g om Signe: alr) / z — t HH, 30, $2 22 60 S77 SSS : Te AIR-WY_A. GRouP OF COLLEGES Alt acercC) arermC) ace C) arce CO Branch / Fact Tople: ~Buita Max HAA CA) AbeapSae = 4 cin. Sor Cis | A. tematin fo | dacon to 1) May _HEPTEGK y fA, S) S Moon tea =. O tsiryi) Jo at 2144 be Max Hearty CA 7) Qeaog- Ce git fC As Aheap Sige ana ALL] SAL ey) Largent = Qe elre tavgest = § is C 25" A. heap Ae cmd. BEX > AL bavyert1) Margery = T 4G { Songent £ d ) exchange ALP) with AL Lovers] MP\Ax Heaeres ( A, haveeh i} eg. Oy = gy ve OM 3650395, Name of ecturer “2X _-& GROUP OF COLLEGES alr CD acere@) AtermCD ace CD apce Branch /Facu LEt.s- m1] ana Pf Laenset] be neo acoraga f= \ten,) 4réy > AcP+ §-\4 cher 2. ROIJ-_ALG+jI Lon+ri = eC = Pte é tcéj< @rj§i > ArKJ=1riy Ea fy ee Arey.» ALA] j= fy F e ao i\s\yle Le Ta lep a] Vw se a iw merge. Sart (AP) Per 42) Corry, | 1 S mevye- Sort C_AP.4) TC) mevge ses CA qt x) Tiny.) xi) O(n) vewye CA, Pd l ¢ (@ AS) _o 3 2) = NEY) STD | |_m-S: (1,6) | ms ij Yl 1 7 Sestisos Nscu¢) mC13,6) | ™ \ a MIB i [ } MLB) MSAD NSGED Cure) = = aa D ; ol | semi) msc msCSsd Maas) Cowtatend is > Tom= 24 T)2) yocn)y = O(n Sogny ARYA INSTITUTE OF ENGINEERING & TECHNOLO! Lecture Notes Branch :... : — GY, KUKAS, Jaipur ‘Subject Lecture No... Ton) CA,P, x) Xe ALr] Js py For (J=P tox} ) x RCArij<%) Le oy ALIt\ Wehr aryy mehr C+} &3.0 [ate] =] Sle ful aj Ala 2)
  • - aa it Walishehs 1D i) PI Ie Nm o> Nome of Lecturer =- i |_-gsC 3) (st asc) i | Tete Tees Le arta) TaSCuID. _GSes39= PCS7) _OSCSwd : © f i a K tea A IR-Y_A_ GROUP OF COLLEGES AleTC) acercC) AlerwC) ace arce OC) 1< Negn< JA << n0. gn dt fnS2 SN LB No gic Son) 45 are Qned < lon dete! Suchthok >| t eT FHS gm) Fen) 2 Oln) far on gars < ansan n>1 Ce ana © 4 on Gens1> H Bemye O(n) Ar . on Fen) = oned j Bnr3 2 Qnr+3n2 me anss < (m2) n>1 | . Fen) =QCn>) As. 1 Sea nd adJLa toga meenScn a ZaneGh = EWP | £ OCm) FT) =O @ *F Cn)= S ae) pcr LS nme ; Ponds “Sitocn) ay} sre commie __ Th. Suncktoms pClama Ne Such wre Boo 2 cacatetnen t & Lom) = ‘gaat Ft Qn an a m2 | ost a [ Teeny s ony fo u Fr Peet ore an oe a3. J Rove I Came [Bia mein (2) é - “4 nyo a The fim? fap: Bigca)s Be Baty + re) combat 2c) Gand n ae Em gon CO, 4tr)— AIR-WY_A& GROUP OF COLLEGES aiet) acercC) aleTmC) acp C) arac CD Len) qvowdA Sdawer Prawn Aon) - i Lim Pon) 2 o : n> Bcd Pormalle Sinko [erm oan) joe Foxter Arm win ete Fen) rows, Lorre Hon 2 coed) jo Ny Em) nee and Fecmaliss « wreated cuy Veen = ew 4o0) Name of Lecturer Madster “Thesker: if a> and b2) owe cmaranta ana £m ao hen dhe twice Compledty oarymptoticall span ine Pid t O_O rrecumeive aelar ta gen By —— [rem 2 a Tony + em) I Soap Pee Ones"), then Tem= 6 (nfebe“) QoAL Sem A Cn¥e% 7 Bron! Toms OCA 2 Seana EOE) doaeAFS), gnem Tenp2 Oar) _ df ten? 7 Cn 1G 26 Aso tee stomd Ot CoB tends BT Cn)/2) +0 | | ! i ] { ec cg ss | Oy ig 2 oP Onde Jog A2doq,9 a 1. oD zs lee SO cies = eee core Yrphien Were pe TS tenjekO)= OOO Hal ARYA GROUP OF COLLEGES net acer) alermC) ace CD Arce C) 1 Sem. Master “hearer at a2\_and b>1 axe Comdionts ond f(n) 1s cos plewity op a recursive relation DA given oy = [tins afr _atcny)y + FO os pen 2 atop) £9 (nk 438) a>\_,b21, kzo ana pis sel te mrem:- (oq n'F4 tg pet Th aSbK Bren Ter).= O(n) equasegn Ney Neon [cone 2.) LE qabk as Vf Po-1, dnen (0): OCS healt?) iB) 1S Be-1, Amen TOs OC mPeae Leg Yorn) “OF PSA then thn) = © (n¥80%) Coxe th acbk ; sO Unk Nan ay tf -P> 0, thew Ten) 20 Cn! 2 b) 1G eve Sen Tend= OCH. 4) Tin) = o23 22 yer, P20 a 2 5 3 O(n?) wy Ten) = arth? Ma beet ber SS)» 'Ten) = 16 TCn 2 +n Os \G, bau 21 Ro) lool Cane | Tende ornseset) 5 Sino or QCor) 6\__Tom}=_at( V2) rn hogy Ad 215 7 Ost, peal kei pe) seh Le Core 20! Tends OC dea Beal dem" Mary TD _Tem ys 2 Cnjz) + Njogysi = 1 2 2X 00}204 jog tn Get. bs2 Kel, p2-) “id > Bt 453) ) Cate 2b) tears OCriSBet Los Vagn') 2 OC bog Sogn) g) ten)= Baha) an es O22 eu ke 6 Sy ED. Ay 22 UPS! care al storys @ cnkieg? me - =@ (yo'S! d499?n 2 ocnesly Ten) = OS TY. \ 4 Yay As oS ¢ % Ton) = 6¢Tlan en oh) SO. Teds oCnMeghn y S oln®20qn) AWRY A GROUP OF COLLEGES ater) acercC) aterm) acp C) arcc C) Branch / Faculty: Tople:. ar | Som, Subject: Lecture No. Wy Toy = gu tT (np) = n*hegn \2) TON) = UT (Mp) + Sogn Qe, b-2, Kao, Pz) cred Eg: Por Recurdy relation Tend= T+) and TC) =i} Shu t n Given ‘oat TM) = To +1 So Tina = TOH,2) +) > Tom) = TM-DY+\+) = Ton) + Mo. Ten-2) = T(n-3) +) Tin) = TOH-34142 = T(n-3)4+3 Pram above use can Conclude Prof Tens Tin-k) +k _towere Keane} oT) 2 T Cn=-n=1) +n-) = TO) +n-1 = O(\) tn-\ = Q(n) Ton)= O(n) [2. Tom = 37 (fo) +n gin Ton) = 37 CNW) +H eo. TCrmyat) = 8T Pmyyer) (Pay) Name of Lecturer: Tend= 3Car¢ (ney) Chandan 2m an jy- bgt CML) — o. x (yg) 2 at dine) 4-6 Cnet) —___——_ > toy neanjurs (a7 (Modi) fo non, Se nu Sn) een Cale) 9) Ab fa ne -nbSeywed prod uae | Nut Lj wie W350) phere ATS Rerws Lefer tne Qe toT Cl. o—__ I oy eT geod be fen rg Ge Tee when (yyi ede >. e ypu so tt 4 a 2 newt ‘ 2 e§ nie i _ CEs Wogan 2 ‘ Bn/q FON Lor QM) l(t ---~- hog, (n) TLL | Wen ZEW EO lnleg, STD) 1 ORO dae aah 5 { “Tess Ten) s Une Olin) Ton) 2 :0tn) su | FR ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur (i) vec Noe | opie: vw Ul Poke mublipticatten - Sprarwen™ P> Chu Aa) C B11 + B02) xg | ee ESSA e ke ee | Te (Ay a Ay 2 Chis, - Aud C Out By> V2 (Ais - hoo) (85, *852 Se. Cys PrS—-T+V Cys = Rae Noma of ect ; | © CPx B5a> (By + Boat Aoo( Sos- Bud — 4 Cha + Ais) Boot CAy—Aao) C Boy Baa) 2. bal fo > Be laa - oa en es Beye le - avin aH pt ello f a : Mes EH Cf © < # Coe iNet - Z - Tt ah E ; ! A Ce nh f ARYA Institute of Engineering & Technology, Ja Department of Computer Science & Engineering Notes: Unit-2: Greedy Method & Dynamic Programming Branch : Topic: ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur Locture Notes er xf = 6.0 Ser’ [St 42n Step S. Repeat steph, Sor ntrems . 4s Ges f= | +0 iad ye wrt < |S, Tren er se piq = | + We W-wreq ele. exit Step 3S als Hem Nave. nok been Chasen ox “Knspsack tay Sth orp te ra lo-wraj= g-s=% . Jls Fos boy 2 S | ns So. xT) = { I W= B= = 3-159 | rep GS tr So. exdi+ Boron oops. Se Cf Qu So tse wilt get a Srraction op Toana Hn equivalent ro Wheopay = Pry So. xf2J= On WJ = = wrery 2 2 2-3n2 2 S Name ot Lecter: . Kea. Sent wo Neos knapsack Cam have. C.imens.= inna. besa —_ apsack by Ful). “Thus fy 20. 9+ mens ne ssi Rg Xj weeny giep= Coplay age} and re Volue ‘arr the pre gated Wy Ve Cx Tice ech Ciara dubtee ee Gl a Ces) Hep 7) ne Sse] 1 ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur Lecture Notes Branch :. cted oy yon 1 vertices SUAS Aceon ns pannive; tree Connected ganph @, if Tid a sungpapl of (oa ond Corcbdinr, oN Verbice Gt falicls ist SFt00 _doas Tinta Spacnig, fete. ee so Wore Baa eve cee ahs sane__qamabh__conmerted rremultng d xe peat re | ub gop = SV home ot ecu ST Kapil Sertay Ato a. Karuna £ 0 |: ALY fe @ Wy wWich use na! who add din. miriaw Yay empty = is ane Set oP rexyice ne ce sp ages So graph G. © reo}. Anifalige tne Set A wit nudl) fed | Srep2. t- for each vertex. yin tre Seb V, 0 Set SI cuts Ate ews us x Os Vi Ie. moke set CV.) Srep Qs Set 4 edger of Pin \neveardnay 5 a, q CP tasieawh>s, f wen US fs Sac _SAge. Ya E Sess COW), che ck PX a. c= ms O aos 1 h Acs, rhe Lage ot, ae ana! ye edo Ni Ae «16. A Set Cu) Le Sn Set CV.) hen ; é As AUfiavee a. women (Vi) Strep. Meee DO L ay ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur Lecture Note: 7 | find tne mst sig Kus kal!s alia. ef 5 3 a + \o 2 28 =| pa =e < (? = Be Oi tht, €3 fa} fet _ 18? pl Jsital we Malt: re Bdge wiyn idvinnwn cost 3 § fad | A= ADS Say A Gpieted Set yay, uiicl Ge, et ig} I Srp Loads I Az A vical | 258.08 Sc.a8] I Opiotes sa oF .a3 fh? foal fer fog sep. 3 {b,93 upioted sar, Tha3 (cat fb Beh ufeavs ch> [itor log {ygt te, a] ay §.ah See Inger fey tep So idigixand Lets {irat leading bg tay {Sa} _Sbigcdey aoe Leatr lesz: Ar Abie 5 FAFA abind Je ¢ Navel ochre ese Oprabed Herheay Seris gf" eds ec) Kort anal Step. J yy xX t Demir cost 2. OCT) vet Be Lod \2t14h E22 2S 238 Branch : Topie: ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur Lecture Notes bankas so SUBJOCE nn soon Lecture No, A's _ MST Algo: fe + Qe VIG) Queue 'e’ Contaes all tye verticer ‘In ai Aer of Kea Feta g IStepu. A verter tsi py ison field In chasen . Fach Bf Wd ad\acent -yepireh Th exarmed. ve min( Q) “3 Lia te ad\ace ver if ue @ and oCu,4) po Key Ta} then > 7rfu)] =v and. 4 ROY U S WCy.u) EN Sh d Exit | Narecocwir api Shana | By Costs Ht Ae? ay49 tut ye 9 Runving tive a) : Cosy s Ud Ot pt? buts 4 > B7 Runwivg 4 OCE tony) ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur Lecture Notes ers Pu Ps Prd> (30,20, IR, & Cari dodaidy dedede ds C243, 1,312.9 tre — —— 1 s H Ss 6 i a i £51 | 4 ———— > i I (a Sur 319 33-32 rermectteae: Kap Skat eet Optimal Meyye. Patterns Comer —_———|Also.ome Greed ee : ae yep-2. Te sosdicphed Goes 2 Files - Shela 4 min 1 = Fide | I pin 2 = Fil - Shep=5._Mevge. Dior win \ and min2. do give, suue %. Remave original Pie and Sie 2 Puc Sige % intno Mist. Go wreip Land ot hN) 2p-4. Exia H_Mexge Sues, Lh UMW Joke min mover . To sninumige ir, we i take PWer csiin Smolieony Sige, =| : asia, Soe. Ovens alppoyacin Dom NEB} ae Given je Sten isin ewan oh 9g as HS3,3\ 25,2 ans i Gnd ame a Vadhe tote. Tota ae de CL Ssh" Sort 4m Bron > Incetaring ode of we Waves Biven ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur Lecture Notes Branch : Wey any ‘ Bas \ ep tat heom | FS ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, J: jaipur i ‘ Lecture Notes: Branch Subjoct Topic ss LOCLUED NO es . ne os 3 e | 3% columna lA} # Rows 1, Bens Shoo ° acowpatishe Anennior* | stapes St moray dimension Gre Covepabibse | - fer (<— | to Rode AT fot J& | te Colum BI ex Chi, Js parinifialinen Product | Ser dummy AI Paiste Chi ISeori + ALUK)-BY 33 Sot i= | ton. i See mpi jj so 4 w= a For Ki oho) - Sex g& mp tc] mp ehh + O72) PBs ie 9 2 mpi, jy Then ‘ mare 3 Zz xSLisjek wo Mi ROMER : ssn psn SOM. Ae a) w w a z z | ¥ az | 26 [100 zl se [ito ge [RO 1 4 Le 160 te [ 20 five {io | 60 a wstighi= 30 stl = <0 » welgit = 40 = yO = | 0 VUlus = 2kO Value = 120 wy Coma (ww) eur), He eo + fit lect then Model tsnn ee w= ly 4 cgi i tha mp ta J Slt deh own _Igetact _Hs at pe ee eked pat of bin inet tite tll ~_paral_usligtadedl,—atrey woned — Oa eg “ iF a oe =< C0 a tebe | tle nlp palia apie clon Ad conaputa ton ¢ Lala tontajrs tho! marin Ay aa &. Od vac KN C424. Aloorthm Olt Knapsacts Qnilie wzilire oroal re lad Wi b i ra ae ofa, wi] <0 jet i wn wer CC}, 01 £9 dor tel bn de eed dy W [epe” thiok'y ites Loan be soddeds 20 thy Kogpioes 0 i aye _thon_ : fla ie wy T)> cfi-L,w, Hon’ f o Cowl] wit of bea jw woi ays i eff, wiecli en sus ij ] wet teen wt we BU) = t do theo Ciwd = ofl-),wd , then> | ‘ | bet {net [Kona yaa ot ek. Y | At _oCipw Te oCi-s ~wW) | Ory | jen Lf pank of bmapsiqade ut cf1') uw find, wow} 7 ibe a. Slt = | Name of Leauer: CAPR... RATE ‘ a t a Pe : acka_baaing weight patsy Uh amet ntenle i n= auth, that Way Va) atl? uw) he, canis ton Dre (193 aold ee . | ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur Lecture Notes anch ‘sem Subject Tope Uni Lecture No. longest Conon. subsequence CLES, st ee ane input rAd one _of the Sequences 4 Anidatty —C=m _and_jan 2_tahesce mean _—n_ooet length lt of Sequence ans Y-nspectivtlly Step i. af {iso or j-0 5 Shere is Les Step2 fF prdjj =*S Shen: recursively, oN) Print -L6s wih fo TN ama (jee GE\ - elre. Lakeman va Teccusansliy Coll py Les Wir - LSrep-3 Exe a! Aigo. L¢s - length '— i. _Caiveny Are Sequencer YC) ana YP i---N] ____| steps. _Arrsiqn the Jenetins of Kandy to Varialehs = “Ser me ox i ne Aevqnn, cya i — Se At the engin, of one_a, tHe Sequences (3 _ Oo, Anen che, j] 20 Nine Locke DD Sear 7 af y for | 2 8 OM ser cht oJ <0 Ser \ <0 TON ; get CLonj Jeo 5 23! gw § he \ Ap 3 Acker js Lion doit. 2, = Yr then : sex cpijjecp cr, i-\)+) > ands BEG ITE" : maa Cre ie cp C-1 59 pel, §-\} ren’ eb op cd \y ec t-\ iq i ona bri, yest, E - © dxe. = Sex ert, Jy ene y=) : ana pre, yy a * =“ E cand Qe g - ARC AA BAD t S$: 2 LA\Gle)ATAL BTS TAS. mer fy hie S32 fase > BAA, BAND. AAD “ai ARYA INSTITUTE OF ENGINEERING & TECHNOLOGY, KUKAS, Jaipur Lecture Notes = Steactivg uate XK, ond Gy XE Ga erie efo,ejrl = 1 | brid 2 SA* %j2M and yi. - a tb = So. E1212 Max {-

    You might also like