0% found this document useful (0 votes)
52 views12 pages

AD Notes After Midsem

ad notes

Uploaded by

odpc4979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
52 views12 pages

AD Notes After Midsem

ad notes

Uploaded by

odpc4979
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
_sMarge Sot RP? » of. pee a a » Merge Sort (A. P5) D Merge Sort (A 4B) S> Merge (Apa? 3 ' > Merge Set Chi Pa) dW 4 PH yma ry 3 Create boo arrays LCs W dor ie | tons 9LLide pp) int) , 8» Bele le i > Ride OAD” oad » RCs t } L{nst} = & 4 Rint % ' \> ie) Wp de) 1 for ke pron D LG). Rb » pods iar ley obse vy phi-ROI 1S for Dele a Gne Dd Me eer) ©) BE > 3 c vi ? “a 7 ei Se msGiis Ma TASCA 193) 6) at JN. Seow 9.9 s(t) ra.) i le /VS . a wst6.oa) MSCRVTN gD) Yee 3 bt Cat yo Ms C81.) 12) i| vein Nye q-P al 24 | » me Yeo 1 \ | ei eT) | - pte | e 2 AOD qa De A-1293 a hPa) Portion (Asp. re) i ; pcr ome ACC] 2. GB qs vartition CAspm)—Cy)) a. f= p-1 AssikSort CA,p.q-y [> for der brs 3 U QuidSotCpgtiey fe © Aca voy s. fein Grcos Comp lon Foo)z furyrta)4n § _ excharep. REL eoith a da ¢ + TH4)0 7. exchange ALi] city ACr] TON)? olen) $. Teturn tet Bod i Sea aayin > OL fog) as ao Pashtion and 12 0 rw4 ae Boe te oe Je 3 Dr- 93-12-23 Randommiseal Partition (Ri pm) } joe Die RANDOM (Pv) ® exchange AL] goth ACI > relum portion CA. pt) Randornizacl_ QuickSort CA» P. &) if per 2 Randorizad- pasion apn Qonslornieaa- GatickSort CA, p, 4-1) Randornrzd- BpickSort CA 411s 0) 43 ~I0| D- 03. d-a4 Snversions Ps BW | | | Sest_and- Count (L) D OF Let har one clement af {hon there are 1d inversion = I, a > | contains < “ gividd Aas Leb-iofo boo halves Siest C9] elements & —— 8 contams srerncuning (*h] eornonbs > (omit sorte and count (A) ~ Ce = goxt_-ardl- count 8) ' tA od a yoko = Merge ant Court (A.B) Maintain a& carrank pointer into ach Gist, inihalized to por front alornant J) 9. Manton a variable count for no ot inversbo inihaliceo! fo 0 Wy a Wwe Wolh Ns ane son - emnphy Ust 0:85 de elamant pointed toy e cacrent. expend smallest d there two b to Olp dst 6g 1 bj D srmaltest element , tho Tartare s sorted Ust L ink tb ae | 7 vperernent count by TO: A hornets Temaining in a end Q advance the current pointer BaF" Prom “Wola Sinaller element (008 selected. 1o end colle \ once to Usk it ernphy » opens ee ee qoram count & snared 2 O Anheger Mulliplicahen 12 > 110 0 56 >+2111000 672 onde ene) \ a 111000 a) | 00 00000 O 000000 111000 111000 1010000 Koralsuibe Algeritinen - Aern= O'S?) iga4 28 0% 1 mR Re : O + Silariaxs 32> 672 x Ales Mcornpate. Ke¥e= 61a “&, © @mpute Kote? a ® Cormpube Cor hy t CE NR) 5 abi —® ® Compute S3-Sa-$) Ro = ea 9 © Compute sav $54 bas, 2 BIA KIO" QED X Wh? GY 26 SA (26120000 + QEU000+ GE BGE2 7 7O06CS2 ° | Ee bi ET esas Halil ay OALTRAR TyaqiL % ploggisy go7p 30H RL XR wy YR ® kus BRTIUG —— iS @ wapry = POH 14,603, SEX —— @ Catera ye (WANE)= CEBU BAET > 20,344, 490 ary @) S4-Sa-$12 784.460 — © © Tag xe + WW .Yoo x 101+ 14/603 SEY a TSQ, S04, 203, $4 Raceartve — Mulinly (oud D> corte = HO HO46 yey aay, Ye. & Commpuhe Ayre & YitYo ®D po Reeursive —Muligly Gti t Mo» 41+ 4p) : } ye Reowrsive- Malhiply Cours 4) © Motfo> Racesrsive— Multiply (re, Yo) G> weturn Gr YRA + CP A1,4,-Mhoy) > tMou, © Ti anys 22° Mots S32 QuAmarecys sya] Tez aT (Ban 2 (Pro oc iy 2 O(n). 9 (o's) Y- Va Olay ies eee — Knap Sack Problem * Knaypsack ~ ‘ 0-1] Kraysack — Frochionalt owt P iy W, », ' 4 a ° : ‘3 Ws °, My Wy Py / cot PCrwbty | Wea hast Profit Smal vb i, ie as M4 oe ae 5 a 1-6 10. us Given storageern) > 12 i ale fs rem 0(2) oO 0 oso ° — 4p! 1 O- esa ' 1 = gos cree) PCa) PCS) 0 0 - 8820 6 1— 80 PCF PC) 1 0 — o Pine PCiay 11 LAR ph possible ap the cot will Become M712 N=0, med KSCa-tsrn) if Wyrm ia KS (rt, mows) +P) WIS 5) LKS Only on) Me 4, me4, ¥e) % KS (44) a No KG) ye SOY Kay Cad, 1 Nn Ve ~ na Ao #801) WSC1aa6, 904) 40,5 3) uy nN) RCO, aa XS, 7 KS (3,4) / FE) RSGiy) i Z ws a9) ‘S09 Bo y i; Ks) Wo, BOD wstoay 0 Wea. 3) 6a) Ngo) iy 3 a m7 iy 4 5 yoo Momorizortier abe Mamori2at®\ “ ° 3 u § Gif. o o [a] 9 1? | WOH) alt 1 aa Q \ oy] - 73 4 \ 4] 516 6/4 4\co. / 1 fy s | 7 | s|4 for Psy wpm > 3?) BS QU DEMS KS Ct.) Cre | oe eyelet) KsCt 0) Gan? 54 Size & Toornorzation Table nl Bie & column = o i Dr- Bog Worth & Knansack Probler ” Pirvesiy ME Gert Seerek gato (ow) Arresy MEO n, Ow] 0 Ca nitiediaa NYlo,w] +0 for each, 9 | for Je 11Q4...0 er foo we 0. @ 4% wes opt G5, w) = opt Ci-1, @) ca “ooh t.ca) 2 eran [apt inl 0), ert oft G*t,w9- 00:9] w mokucn Min), aca, aD wWe2T7 Cr CU pfofofole |e folfo Vfo [OJ & eae af jo}a {2 ]4 fa iala 3/0 [0/2 13 14 [5 Is|7 + Bell man - Forel Blgocttbn ® Single source shorhest petth Dokabw Bellman: ford Positive Wr ve agate ok Vix a Net wh Not vossibe, x (datect cycle) 6 wa a . 54 we have n no. ct nedes) q tb shan we have (1-1) welaxes we 3 Gdgor > AC ae cD DB thee Uk telox pier. And et relax elon ° 29-6" % 26g } 4" | pS D A é 4 Fe st et se a Cc k oe a h@ Be ce cd 0—Oz Er °o ~» - ¥ o\ 2 ze e L) 2©@ = © -8 Cs ° \ * 6 Las) 6 byte of 600+ © 53 3 (6 Rellrnan- Fore) (O00,$) iy Snirradize Singla- sorce CG), ts 3) a Soo iz to IGVIs1 > tor each edog Cave Ge | Wt wloxation a Ralax (u,v, a) > fedgr each edge ca meat 6 fb vd » Ud+ wu) Ve wt edop | 4) saturn FALSES D peturn IRC: Tends OWE)

You might also like