You are on page 1of 26
7F Exteenat Sorting -¥ Eqlemal Seeing Serling means Arroging the t d ) deeendin J ‘ ( elemertts etther iM A8cending sldey Cor ord aoa of a=types Isternal Sortin 2: Byterol Sov ny |. cntexna| Sorting + Pt Sae of the file is enttinely Stored in RAM axea is Known as inlerva | gorting: Some of the jrilernal Sovting ~techingues ae bubble Sorts ensextter) Sort, Selection sort etc.-) Sorting techniques ave jmefficren files as they vequiy the nn the main wacemaly , r0rely (. aby! | the ‘iternal 4d° Sorting the huge entire file to be present 48 practically Gmpassible So the need of evterna] gorting technique arises to Sort huge files. a External Sorting? Extemmal Soiting ge apyltedd Whew of data to be stored So | there is a huge _ amount _ > bt huge -files axe Stdled fn evterna) Storage Clevice lke, | naqnene abe »maqnete lise etc... Bonn Kaen mnergiog s- Herve Sorted set of xecords in | The wns ave merge 5 Using 2- way merging * wooy ond 4 Now» the question is which among the ie is mintmory ieee tree. This can be easily oo by weighted external path length (weEpL) The. wEpL iS the -total merge Hime Coleulated by adi the product of weight of an external node of) kp of an. externa| node. WEPL= 3XA + UNA xe WEPL= 3x34UXS +1249 x INy = 36 a = 5% frm The vsepL value ad tree gives “The mintmony merging HC Sfiees, 54 There £5 other technique -to fincting a binary Mie vsing “Hoffman Fee” Gi) =Hofgman Cede ” Huffman Trees- EX Covsider 6Chonatters Q, +0 6 with th -Fortoustng Uotues 81 each node a> _ HQ gets W863 358s Wye ds W215 5 46° 28 Cont a ie tree P find the Hoffman code 8! wh © havactey + a find 2 smattest Values from 6 Charactay W413 qa=6é t) Find 2 Smallest % Vatues from Character Irs t an f a b) Replace with qPap tn “the Chovacter tist (8) fl a | (0 [sl I] [5] [a8 ir 2a ac © Replace as with |g) Replace @ with aPay 10,1545) tn the Character fig t— i) al 2 128 to 11 fis] [28] G) Ghy - 1G ; 25 pe ) @ ref fh say | fal [el &) (6) h ie @ Replace Ga with 14,d5 (2, [Bs] 1b ae Luffmean ® = SIC) ; % JS wep! OX1O + BAL + Gyr, ® ® PIAS + U9 6 vy 7s ‘ : [sl 9} 0 [15] MB FAUT ATAYS 4 Ih, wy iAL 45 164 fl fe] i 9 ee or 19 the Huffman codes O04 key node +e] porent lovight node {ol povent Hoffman Codes 0 (-frore above tree ) q, = loo = en dy = Io) 4420 93 = loo ispeaul Alali thon Step): Create leaf voce il the each Chara fl) ---~- Stepra): Select 2 wintmeom nodes jn the list Of Characters Step): Construct a inate tree by Creating 4 | new iviternal node eoitth Sei of 2 | mintmon Values of Q (is. The Snir tl q l of the USt 1S consitey as a left chtld 4 the next min mon alu ag Véght Child. List Wtth the titernal ne Repest Step (a) £ tep wti the list has a Stale Value EL* Suppose “the weights ate Gye 53 Aye ts IGE, Yer B write “the Step by Gtep procedure -for —Hotfman “Tree a cind 8 e do . I ace C 2 h © i a ery eu @® kepiace @ with 10 16 [3] fi3| % @ WwW G3) ustth 1013 Rg eee case Pe ig & \ of\\ of ar ) 18 6 12 yrwrttt ty I ZN 6 Macaig 5) A = ° \ as ay 195 2 or e —aaon———.-—™sts ~ voEpL = 93 é Hofman ce cles ioe ; q, = 1000 5 Ia 100 46 ol inctnencioes yew Quustions ys 00 gecbld 46 , 1. Assume a list containing tev be Sorted a oo ie Me ‘i Capable of Sot, 7 eae aaa at. ae she YP ust 75 Mak tong ON adise -that has block se of A50 recby. FS this cendlio explain exformed to exon Hwmplish the -tyy,| Uk weal merging ) wth inte ral ow externa] Spr, ge) ea No-of vecords = 4500 RAM = 150 a No: of uns = soe Y Bp : on a ; a Each von hove = 150 vecdlds 1501 ~ 300 |geor - uso} oie | ; [Eesen | i ad BD ss00y merging aos) | - 15 315 e-ts00 ) ae [asI-1500] ee iy --[375 ag u pany [i- ys0o a7 peor anes ins —* f se fuemeo] fostzisbe [por east) - - [— 322! [F7s0-yse0] [3001-4590 | IY } yw @ ®) @) ‘s 7 @) Og 1) 6 Oe ey 63) dequ= ee, (6s) @) hy legnert* ec = Run Generations ¥ ohenevet the Inde yons ae of e liner Weer | 7% | tages then empl Con be understood Clecot!y by the Winner tree: wWlnner Trees Winner “Free -tdinmerit -tree. TN erarnemnenit ETee node Qepresertts the playe” p quternal Node reprey, the winner of the match bho the players. The Ortexall winner f$ the Tool nodé- Example :~ considey amengin of tH Rens veEin winner f loser tree fl the below Table. sae! - 19 \6 30 ce iD Qt 35 Pine Runa Panes Panty Ours { wi gone i rey af! inner peal vy loser wine winng AF ey, ; Winner he ; “I 16 wiuney afin IS" ecard qs oop? Ly windy h ‘ > Rawr (is) spree. A lOsey +e nougin St ue a! aby, panernit [OSe4 @s Compared ol, | 9 each oy LS ot generat a Avsther way oF FF ps Loset tree Ee eopanes U) Ga y a @- overatt eval winne 4 ¢ te 3 iS __ winner > Runnd I bouy 6 fo Roane. ( a ¥ 5 @ gon cm @ © ©. © jo) & . cos ia node contains to¥ ha: tr ater 1 vated inthe internal ¢ eoch trees ae consistf of overall winner ts Sent yn loser “bree —the ed as loser trees The oot ‘ode nner Of the -tornosmenit «The call yo) denoted by o Spectal node the eee fox parallel : Bima [al 4iss N ; e aati te) oe sip woe Sakon tae foo 3 oH | He al in (3) int) T ov(') aie | | out 2] saith Yechids ftom ™N ae ait Lead: wad er 0 | i ed from 4 Ste = poles for Run! tip Buffet 460 Roy | [ one i y a) dase ie, az fou) mia) imb) any p [= = 1 — ov). i ovti2) Pead », Load infa) with read FIM Tun | Pe pane? ee oeperatien ovr ents) tna). Store OP in ov(i) step T a better "Sov Ene tp Be RON = on ev —— 34 — ustite: The ont) teterd ery im ise, ead: ‘Oad Miu) with vecs1Q from RuND Mevge > apply merge operation, pg ain). tats] Se fn(3) ov (1) ov(2) wont. The ool) te ad » Stove kn as BP" Qaad ) OS. Merqe* Apply merge operation jn mio, mul. Store xn ont t) Step Wo: gp better 40 ReNI tip botta dor Los mou) itd nbd mtu) C1 “ig € pvlt) _ ovlaj write The ov Megs* Arply wet ope* Store fn 08) See Here we are Read: Load the aces Se Pons imto “bupst buffers: Merge Perfor mop onthe Stove jequib nu + olp guttet y record Amcioe in dS otto fot ttad,09 paid 3- oper attons Up boffers f ae the vecords fw Op La Fey Po “the cliste ee Handling sotth flesting betta, : Bofgertng Aletiber Here Noof Botfers asstynes ma ws ea Yum {$ fired. So. time Cleaty 4s OCeuyy fa handling the pulk amoont OF secélds, > potfers are Sed roy, NV oot Line e frm Overcome this —fleatena Cer we need- = bees a Poating Buffer with veny rng Hnown as Boffering —Aigortthen | Exq):- Liplimest oor merge wot —Hloationg boffers dl je wns Showns bel thet last block OF eoth ru & Assume a a worth “eq (4) (Gaded with Centivel cdl the blocks ™ Lon op Runr ole as Potlows- obo fal (68) fo 2] [= Ron. (a es r=] ae Se lela Soa i = a al eee ie Taal ae Se lela Soa i = a al eee ie Taal “hh ee Mette. Proce Stepe: Take Q floating boffers tes Ohe fy each YUM + yom) The stack of each F letting Buffers - Load-the St block into eae Botley IT block from Len-a frito “the f loating Betta, Lost Key (1) = 43 Last key (a)=3. Select minimon : Next biock 48 toed fiom Round. Stepta):~ The mintmum Keys | 2 oPte nena ey Stéled into op boftey of Next vecord ' (oad -from Vonta) into a popes butte. by Last Key (= 4 5 Last Key B)> 1 i Meat btock loaded “for Loni Step: “Re minirmon Keys 3,4 are ameraged Sted into ofp buffa f Nextve chd 46 load fro" Donityy mto a Poped butta by Hast Key (t)=¢ 3 Lastdk = ; Key Cu) =€ 5 dost@kcey (3) = 7 | S Nett block loaded -frem “Cun > Step): The Mintmorn dey, 516 Ove mugd ‘P Stdled im4to olp bofter Next recdd 74 (oade Ft Ruta t-te a poped butt io bY atch Me! \ (* Set oP V- linked ques gasat “the ate . ‘ plock of each qun into 4 élp buffer el last ey (i) ee tho Key catue % willy fae ++, Select Ge (a) 4 ano the ‘lp buffers 1/s aohith metl block pe minions ) om au the ip nwt Beta “te blocks 1% i as follows pantie, ae [as a) el peal Qon 3+ fos 30] ey Ron! Pon Rona lp Nextt block from ig si ah 34 fas ar) Tae se) on | roses Co) Bl eons 3 TF [at so He 3 Vig aad g RON & = ¢ Sls] Co) Ces BR R \ 5 of 2] Coase les oN E Qon 3 it (aa Hae Ties 3) 32> S Fa ia foe ae 3 me & Co-ed rpeRE mass 35 ca a) eo el tes 36 ee ay Cares) og ts _* | 8 ate sti ecm] hed fae Seake li Seek. Time ¢ the read Tene taken to ce fl write head on 10 a \ Cylinder fp Ht depen mt Mo of cy clndas across which ™* . head -mo0Nes + 3 5 Latency There Tr fs ee. ee R -eaken -to position Sy, peeeG 40 “ais “ight Sect of @ IES “Fronsmigston “Time” gl ees ie —trousmtt the ~ frm

You might also like