You are on page 1of 20
| Dividle _ andl ond UY TQ ome. Seven NIT: a Hit, 0 problem is cliuidled inte Sale _pHoblems 5 re pHoblems Ore, steal Be a onal Amallue pusbloms ae Lambinecl into! a 4 eonoran Binary Search » Merge Sent 5 Shassem's mats Bae es Mutiiblicaipn. 4 ia | Bioasy, Seasich t |, Binary Search peaformed on. 9tanied army: —__ EAE 4 india ning Sec Search uses lhe Dine: al >| Mare Min Problem? 7 prablem lalement Find the Max™. and tein’ value iin @ Grey « Method ~ wi O| Naive Method ie Divide and Conquest =| Max $= Number Ci] ee [ea [se Date far Mint = Nambers La] ico, j= n-a E for f=2ton do Wess find mid; Ot¥. ts = isa] | E tf nwmbexsli] > max then |s3t Split the omey — } max? = number Li] 316 x whl WOE Tf nwmbew Lf] < min then! tae) min := numbe [i] [shu], | yetwin (max men) Suet | < , each nays a a pe Sl Mine A 5 Mare D4 (am parivion “n natve | Method = AnN-&@ and’ q \ | +h, spelt : eee a Sanh Hi Lege Sart? cien = i 4 38 )2H] 43} 5} rt}, bo T : oe we) ny LB! _ SKpI5) find middle point amd. divide | 1 Jack — mids m= (+) /2 E SHpr?| Cala mesge for first hate _ p+] 3 Japez «Cau mangeSore- (ar, 1) ”). ! 4 [9/24 132] 43 | —SHp3:|_caut moypeSont (oon mat, 9) 37S _ wie (S2,53){ i Call morge (0°07, |, 1,5) 5 Quick Serf T= O(nio hh), Wee-= O(N” and Fie: | utcxsort (hb PA) Pantiion (0) PH) Ud Pe Pemise (i) ‘ ih 2 AGI ie va 2 = Pudttion (4,24) 2 Blea | Buch Sent (Asp, 9-1) 3: for s=p to4-1 DUK SOE (Ay Gt, 1) Tf ALS Sx fer entre array A, fefea | Buicksod (4,1, A-length) recharge PU] uth } we | Scluchibn. Soot: pee | Po lest solssha Tera Z pi LUA elomimt and xoplace PL 4: Cxchange Alin wate AR] 5+ Setwun F 1 fe. tatty Sonaltere On: Lelo3 [or Puls Pa]yoliy] es TeCe= O(n2)) (ol axfa2 2s) alyelyy a ns - - Date etin 4 ea] ree Linas 5 CE Bay Peetgete] a o- Le Ge eaaaeae Pata: ass, a J hy a i Ter ow) A ditle 2 conquer Methad ? 2X2. fidabtes te \ Srna pbx An Ar Bat aft a a Dif bb 42) Sa} 93% B boy ba2| bez bay rl Sy = Arby + Aa.’ byy or L pe : Peano Sbarro sale Veli pad | Coa=Qarrby* Aar-bay | gy GRY Hey ye HEH Bae Cor= Aaa? by + Anz" boo Yoo Ee Now, Sive , 2X2 mann “Tei 8T( Rees Tin) = B(nd) I: qT. Ay Faz | br bar] tu bi2 | = C[P+S-THV pot LE] P= Gs Ras) (ontbas) ial G= By (P21 + Aan) LL [R= py (82622) |S * Pia ( Br -8n) T= By (Ay+P2) V= (Bir By) (Rai Au) Y= (Bar+Bon) (O22) le Ms RC > Tn)= FT ow?) tin)= O(N FY Biss inl ee hai 13 \ 7s | LO estas are as Crveedy about Pro, 11) Gjreeoly about ULeighe a 3 [ool 24 i f J — Select the mame oj 242 ) Bieta mitrdmum - ~ Obj L {LB eee eats own Youre Te hot. f | BASE ot 2 2-2 _ Profit ifs pte 92} nimi Ss banat iSeries ce LO Suubsck | | pa Oy ini a ewes J hig te -dogs not have amy cycle wid 1 re re ‘my vetea i GFtro ls oF wade. TE SAT Gt wer Fravense Wi p i S Sost ou edges in nbh-de: | Select edge urith min- Cost: |G pick ee Gg 2) Ds b repeat fa ae FS ] > | 2l-s7 2¢ 33; 6 Ae ooee (nee iathesd spe 4h sh), S (SA) a [S30 * TOA GA © Dote : G=50)b=10) C=30 Si b=S5 C23, t= Stepit [Bunda min heap Inusnioh each note Sepresent tha vort 4 A hee Witha bingle node - X - 1 @®@ © (9 em ature BiG —_SEB2! |Oblain two min freq y node © a ——|}riom the min heap » Adda third es | tnltrmal_noole 243-5 wtuch 4 Crate J | by Joing the extracted mooted | SHp3: eons : + Grek min frog: node 2. Yepente Step Seige eytns Z (Frat x at lorgt Aor Z fequnge "Solutions 10 Sub. Pritts: Sa, ernpikeh dations _| Combines vane’ stoned tna table, Ao Hose don't hase \ tb “He-temputed: (Optimal Su “Sub- Sbuchwe ! Wat gy ven. problem has | Optimal dubshrichne |puopenties, ff the Oplimal” dol? of the given problem cam be _—_LOblamacl. dusleg aa Sel? of 1 hub brcblems+ t Chanlenize. the phret+ of am optimal 3al? » { Hein "Recursive clepinc.. the a ol} Compute “the value, tn boltorn-Up ees | ee pa = co sl ~~ t pote | Ue 10-2 Knabgack ¢ Dynamite - Prcpanoning Afpuoach 5 We commot fraction af am objed' 3 G'= | ie Pegi, 2) 5/63. |p|. wraClapaats)= B19 | a We 2,34, 57 raat i on [tai dl 8 ah oy eee Seal bs al Peake | Gendrad:s i x Fovmuto ‘ re § Ds. Selected flem iP Hy Hes 5 A _ flem Selecked axe (oP Jk ° ae | C22 %y), Bl aepinidt see SSS Geez — 1 Sabet Sun Paicblemms (Te plek A be an Osay On. Seb Wich orilaine "Wt nin= lage A-$213,5, 419 Suen (W) = 4 a Subitl 'x’ of Sot"R Sun thas Bum of au SumG\Poa4s ¢ 8 Leees Bote Le aire to make am Qmbount dinenkete ms | Nina MO a cone $115.69) BUGale | a fable 6 Gye. (Sum+3) x Coin- Size Q- te [Jans Ce 0) i —__ons[iTGJ = min (ona Uf iF Ci) 5 4 pamsto Bi r ae op also Known a4 U2 the. Se ch citi core on to Leauch O_ fee wcled. huanch tk tp 0 nee ta Hoa dip P= ct Of it ae 2 pst eee ‘fan’ rode? Th)= wc, 2 coe ry % Jo, 20,30 _Tt)= 3 = aA Fi kee 5 2 — pe } tl 9 \ de rH re ae ge} a0 i. é > wh 30 if Seo 6 tt = o 22 ‘ = FP nora ? 1423 Ge 6 } Posen Se = 5 Heh balanced q E Lo ~~“ Cest3| Seaanaa dram ering (v0) 5 22a ay ag \ 2 int tun — 5 Cet — Problem: Geiven the _dimuns eae ‘i oa Aye Rae AgAy Sx4 4x6 6x2 OXF 144444654 a ee eee Gor oe | TH 120 88 ise] iia | Bes aa oO 46 404 a 2 L 3 0 | 84 ime | a Eo Qi ra) ] ig E Mp a]= Ay Ar. mate 5 M[23)=A,-As 5x4 4x6 = SX4X6=120 aXe 6 Dote : aie Ns) = as ay "OD May eG a — = by c a I aaloe ane 5 i General > wy i rormata—* are Were Re sae ma Oa rb, ky OS Tees} | jai el q ws te pieces 8(n3)] = a7 \ as iz] | Largest Lorie, Salaeshae , paplem: Gaver tuo hii “Stand 82, the 4gsk pe fide 1 the TT amcor Autsgtinet Fe: byut dutepuinad easentde ee A longest both_Airing. a _S& SeaStone Sp Se LS z 0: ]a04 a8 ololal 0 iD *O “0 tO Cla] One Q Oo] *0 0 0 | 0% ty Ny | Old Pies [<1 [Fa [Site 0|o 7" N@len lez fa [a | Ss ie 0 ul C0 OTe <2 Ng <3 @y Length CF Common Sequence =F first Create (nt!) x(M+#) matixy fill of Yow 2 Col =0} 4 (SiCt0 p= S209) cUAG]= max(cHIG3, LUI) [I 4 © crite ar cfrssli-ad L g Path ABcDAS> 55S AR DCAD. $5 ea AcRrad Fo _[AcbdRA > 35) aC _ ADBCA =) 40 i Ta ezGHp > a3 D v 18 is wee i aa As tA ee ae oe Dhiiial pala Tap osaseSey i Ww Divide 2 Conquerx x Dynamic Programmin: _Subproblems are Solved RCo ‘ } independenty . Reo [reset cn ty ——j terntase dE all Atlin Sith It ig vecurgive- |B) Tt ig Top-down approach:+ Pp It 4s Bottom-up approa. It is non- Recuygive+ _4 See ea aaa Subbuoblems ase | [| of each other: Ps dnteHolepeniade ab) ke a oo Bina» seen Po Mate muutiplication aa Dynamic | "i Progamming | __ ve: a [Optimal Bouutien « Sea Hrmal Solution © Dn vp, We chooze ak each steps __|but Cheice depends on the _| ojBol of Subprablemes : We chogke immedtiate best | Ablution at that moment: bidite am oplimall | ssa g: fractional Knepgack - rt T SGT DES op}ana0h ss = ry “Aolve’ ee denaeae the B. -Seanch 0 vive. the. problem: = | - al ‘check has - Solution pnts then come back ana semeyay j *X Stole Space Tree a 1 a +live node: The nade that ‘ fur thor ee ee ieee eee Node Prat fy ps) sue Ferm ais as ee Dead nod 4 1 = rhc yee ieee - Buen és tre oblem tag fm ~? Gleam Pueriber FD I i @ olebth Wutse ravens "ia. Cot» Prem. te’ be Anno Dlaced > Same Core Sutton, 5 Solution fe sits> [21g TTT 7 BOTY | \ cole = a es Si Sum Problem {Using Back Trackéng J |__Find the Subsets of tho given pet" whee the = clement of the et Seren pluitlioa tales Sais p—|thot Suen of QU elament (5 gual 40 heme X= S=(3,4,556) and X=9 r 5 l¢) | a oh Two sol” mig ae de 2 ae TE EX3 loli 7 ee | ‘ a 7 1 m5, s Sag 6 Ot Tt “ si by er Date | Ei a Bis | Ramittonian Path’ db ts. pot th a ‘a iis “once! . fs 1 Sl -foma_ vert Anal Trove, “| Hamiltonian Cycle, Civeutt * um atte oh ae then Hebe. ta haliclieg hamiltonian _guaph 44 «| Hamiltenéam Cnaph a connate tl eal ge Hania. Cycle a a y y y | Doble Sialement: & ______ |Guiem_a ab Gz (Vs E, pave to fink _ | the Hamiltonian Crew using Back iyo ches al L q 1 at eae | @ ors tO. ae ae 7 os oe = Mi Jot 0 {I q . 4) 0.1 4. 300 [tt oa feats Bigg = ani | i = 3 [een a “ea! Gn) mat od a T aD, | X{kJ==0) veturn; : f : iia | etc) ae ae t fer tie teieay do fae | & (x==n) F | —o oe spedee=26 | eee | ken ov(k= =) wp al ie ire rey | | State SPace Tree ( souions: PPTs] , Ws A | Branch and Bound? See FE ak esdithn ess ic na re bi State Space tee King. _but have (uost4) \G Tote? Coat = ear | pitts tt ee eee Bee = a Of) knapsack VYsung LBronch 4 Bound: a |Algnitthin $ - 3 4 | ze Lit all the tems fn_dlecreasing side. of Matin (Popet Walue pen_Umit wet ght + 3 a b Tnitalize max: profit » max. Profit =O z bi Create am__empry Queue, @. Py Galen olum: node amd enqut. ito Q. | WiniLe 8 1 net —empty 1 PEhad am item from @- Compute _profte of, next level node i P) Mae P, Videk ITOK, Prt ght | Value | Vale] Weg] Sorting wast vane dibphasl => Stncey Mare propit #59 hese Optema/
  • You might also like