You are on page 1of 14
eo el : Mopure-2_ . ob PUL =A 2 Meege Sort — ERG E_ 5 Mex 4 fvtde & © wv! , fot 2 halves Call THE tor tne rater A nen r inp th Oreay Sor a nates ac a Hi tan a cre aCe}. —| meet Step 1: START ~ + Mgorten, Meg Sore Cae C9 ve) : af fo Ea _ al Evi Into Middle, m= (s ay) 2 sat - Seep S 1 Cow Suge Sort, for ffrst ave + —_— dba Marge sors (ave, My ™) —_——— Seep G2 CaM Merge Sore hor Second halt ee ean Mage sort (avr, "+1, oe bas ee Merge tre 2 hhoives Soreed to step.2 and seep 3: Mage. (arc in) psp $d SteR& 2 SToe Exorple 2 Accoy 3824 433.9 £4 to. —— 36 [no gel ude esal alg ged ated oe 43 a To Ta [a [aa] — Quick Sore eS Mielelele <) and_is_baged on oe Dy av of data into Smaller arrays « fA ‘ang e age aso ts heatanal tnto two arrays, oua of Wich Wnolds Value Smatier than tne specified Shine, Say pives bares ____on_whieh tne partition ts made and anotha ant holds __Nalues are ater thao tne pivot value: seman ——¢? Lh) vay Hin Bi Relenes Soe parsons an art “ond “then an = fase e to Sort the two galling subare + TW aa 9 : Bp Algoritmo ts quite ehictent for lorge = ;__anletal ‘ote run 7 F Quier gow ts 0 ig 4 egictent Sorsing algoritam z . ee = START 2212209 re e _ Sep ee a Value.‘ Woe ge ________Step_3_= Fake _a_voxtanies ta_potnt tekts_and_elpnt of tne __g- E we SE Atte eaettidteg! pivots. aw oe oo A= Ler pots to tne lou Bnoex Sep 5_= Blas. points sree Liga — a i Sep = We value at Inge fs less Roan pivot _roov. Step i_- WUE Value at vight fs greater than pivot Tove let @. dep 8 = Ty bot Step 6 A step t doernot motel Swap lept A Ond Sea vale “Beep A= Dh lett Z right, tone_potnt whee oy met fs» anew pivot . a aay —____» seep to STOR, és i a ae : * re eee 2) Quick Sore Agertonm, — Step A= START. : SUGA~ Mare the right most Index Value | eye most Or onid point Bet as pivot element - Seep 3_- Parrivion the array lsing pivot value — ——Sbep_ A= Butch Sort Lege paratition re Cuastye ly — Sk ©2_ Gudce sore_rahk partition _ ke cuastye fe its Quen git gre. Se — + s 6 2 a Bie s 6s 45g @5 60 55 50 45 b decide dk ge Poss tt Lag low > AS 4 40 a Swag ping £ * 65 AS “&. Wo - is “fo 35 Se Vo lows pivovse~ - sang peg +60 4S co Ss (65) te bo FS Ho > placed 4 ae Se TT eT. of oii Pass at Constder tha. aw ee i = 4 oye ‘ bo iG bo a : a A iE ys Vor low _ tga « | 1 L ls S52 AS > Condition fale No Soap pled 7 Li L Fgh sa __________ Repeat the Same Sep — ts © Go 45 Sos a A Ni ae wot oe jour © a8 & . tag (Not weed for fefesi towing Oe Weigh 4 pivot - 55 _< Piwot (fo) Sis 4c 50 (e) = n Pou 4 is — oy $< 50. 45 Swapping a A a fyxed biaed Aita_kivst math, Resuitant arog 2 — —_——_- AS 50 2 56h GD. 65 oe oo ee “Than age Same. mitland 4 cr R as : ee | | tag ! Finding Mariroute & Mitsuo _——————— as To fend the mivirnum Value. tno an arr 4 Agee lt cult. ‘The. most natural approach FS to __ bate ene kirst Wem and ko compare tks Vai zi = kre Noucs Os A OXped _Qlemments._Once tue _ffod a Smatler emo ay | oo g Rone St -1___i>ax% -_i 32> b«1) 4 478% = a 478 Je a 6 G>t = @ Return -@) > Markrauco Clement Co zo 3 o(n) | rp le nay Serasgeds —_ Matorfx Mux sipli cation Lick us consider tuo matrices XY» We want to. In Strassen. osksct uit Consumption canbe tuuproved a litre Strassens snoarix multiplication Cn_bt_pessormtal ony on a mere wt w _ Constder 2 roast ces F ° Aw ss F Rav Mau Resuttant mote Normak madd a _MUipcation > SSS x > Srls 454.28 bro 18432 Pas Bux $3 2 Sxte 38 ; ! Pas Aag.A Sq = 4% Q= 7 eo? +F 4.2 Aagr $4 = 4% g2 8 4 =? Pet “ht of : Pos SsxSp = sxi3= 6S \ z ae | agent hol Pe = Sax Se + -QxIS= -30 , Pz 2 San Sio = -2xn= - 22 ; _Reouitone Moderton = ta 22) lag so pt gt tek nt ot Cys Pet Py~ MotPes 6542 244 (Cao)= 19 C, 2 HP, + Py = «.. 2 Cag = tet Pi eo tye 2 - 24 24 = ae hr Mma BSHBH 4a 65 + (a) - 39 —f- 4a) = 80 ne Vine Cousplentty > of (nia") polach &% Apytotinatey Wo z Greedy Method A Gree algaritine t$ a strap, tntustve algorithm ———WWat_ts_ used to _ op ssl problems: Tne jorithre makes the ~- OpEmal chdtce” at fath Step as it atkempts to gnd the everall — Opkeroal__ —to__SoWwe_the__enteie _probiern: Breech orthma ane. . Tee sattadagt fn_Somme_problems, Such_as _Hufftroan, —__tolich to used ca tnuptlh date ar 2Gsséah agai, wolich ts al elit ake) al alalehatetalelelclobe « ted to fod the shorbest. ete Z a is_om algo i fo that_buflda up a. . pt tne _next piece that _____Olgers the most obvious & fmmediate benekte- So the Probtems * wo hee cally Opis Ae Lobal Solution are . ae ge T i al also aan : . : poe oe eee eee * ___________Koapsoct Problem eee ae eS —The_knagsack problers ts a probien to Combinatorial e. Se opti gatian (nding an_optimal object tomo kfuske set of objects). is aie Given a Ste a4 thers, each vith a wetght anda Natue determine tne no 04 tach teem to Include. tn a Coltsctton Ao thot the total sachgnt 1 eas, tnan_er_ ea ual boeee e728 Ragin Uadt €I dhe total value %s as laige ob possible. yy Kmapsacx, [NS a Sack whic we need to place. ie rent eems neiosdiny ko bhe Capacity Of ene Emapsacts — - “8 arith, Cs ctw) ty (e 4 mo) then bs be 1G) Select ene nent (Bore ») _ © Os, au 23 — tm A\gortunm, Like knuakals olgerithmtefrs agen 4s Gre agora. TL Starts with an Crop yy pansing bree Aden ts tO maintain two ses Verses. Tne fest. Set cna | also a The —ene_verkices ale tocluded tn the MST, the otner_Set contains Fame Verses nob ys tocluded + At every Step, tt Considers_a\t_*ne __edges tnt Connect the kwo Ses and picks the mado im aro , an ae a "nein nego MST. Mgorivnse_ , Step _\_ 2 START : seep a i Mot. PRIM (4,w,+) , Step 3 2 for ence Ul GV Step A us Key = od Step © 2 eT 2 NIL 6 ve tey = 0 4 G2 Gv B 2 wile QA 6 us Gatract-autn (0) 2 foreach VE Ge Aaj Cu) step Ws ts ve sood uals Ve Key Step 12 ve Te . Seg tsi aa ls) a ___ Step 14 3 STOP = for a _partiiator trput the [for a particular input the Owmpuler_ will give “~ Computer uh dive Aagerent Same ar Con Solve tHe problem in |Cant goive the problem fn POLMoMTal Eve mnowsal ene Con _ceterring the neat [cannot determine the next Skep_o§, Oxecakion [Sep ng erecution due to moe. iii . [Soa epee tne alo Cth Gan take - NE-_Gopiete prablera! Avy _penbiern ts NP- Com plete peemieen _ pate ern Jockin NPA NP tard problem. peg : a 34a Potumoucal eae .faeeeoeen e roe ttn, patentee hie gs ttn —alpod . 2 Nee : Y) Complete 4 these probidht, AN problems tn NP * would be Pou nowdal ee : i

You might also like