Download as pdf
Download as pdf
You are on page 1of 22
Basic Techniques = PRAMS (Ch.2) © Polanced ‘Tree Compatubions build balan. tree on top of input emank 2 hawese Soeur bo voetT and Hon Ick dasn ages. ~ internal nedto ste info ve dade in leaves sublee thon root ~dopinds on fist method. to deleraune inte for puteat ‘rom dt, ot Kids (or via verse) Pore of simplet, mast used parallel Pehnigues cg. Sum, OR (Geen crew), prebr Sums Example: Amy Compactor 3 : ingnf> array" Alicn] wf men labeled ebb Cb og E* autpat: array Blin] Condrinig am hleled elt tr Same brdae gurl nA. 1@ezy4 5 6 g A fale fs [ule la, [a [en] ®t fetal tlel 12) 2 All Pele] = nte Indias tr elk in Bam Me (ges soe he L array. 4 a ” 4 Time => Time fy prebre Sums. Olle») Ce malig (purr bound on be of Ulan) ) Wok? Blof? 7 2 Example 4 Peky Sums (028, non recursive.) s(F Pease p af 0 34 sto ink y ” Soe NZ ; = if are vantobtbs ey (=a) | att) rz \ he [-8| ae tae iS * use avy amas Blh,j) Lov upluect C1#) traversed, OLWEIeym, 1 58% C05 for down und (24) Laverset, CC0,;) in preb sum Q fe 1H) én parde Bl0,j) = AG) 1 Nao @ for hie de logn deo ‘ap fe 14; & n/ah_pardo BCh,)) 1= Blk, 23-1) +Blh1, 25) a4 Fseed 8) for hr=logm domle 0 do Gown) by leje n/ah parle wy j eens CChj) t= CCheil, dh) ae get) tw) jet CChj) = BG) &) joddyi: Cth, j) r= Cth, E)+ Bllyy)< ee) @ pate do = do all eabins th paral ( pardo > can all Hecadins th pan Mey, ane Gnybrily [ EREW Phan] Assuming “enongh” proceso Ces) Tin)= | + logn + logon = O(log) The toh number of atfal operations prfoemed O(n) if not enough processors (Cp en) Th) = ( skp 1 > 0(%) hme Shep 2 = at rach Sool (value of ) divide und. oe amanry PR procs hey 4 betes $F bo OCT lyn) Ths Werk Slap 3 > samg Cost ol ¢ + loyn) Wha) = OG.) (usehl wrk) Tohd Cost Cindudeiy "wb" processes ) Cy) = We) + pTin) = O(n+ plogn) (cham So Y p= OC ign) then bln) = On) rach vy ophmal @ Reaunsive \ersion + Note in non-recursive worsion tat vn 2" to botbm level we have prefix sums Pr all cbrments w/ bin |adjto O if nz) # thm 3, =X, © fr le he ™, parde Bit Xoey + Xe @ recursively Compute Peby sams gy ty, Yay dys and Store tn 32, 2,0, th G fe Iti tn prude Pfs sp see bsp 23, 12%, bald tr! Sp 2= Be ypyt Xe Onlrily (ase por) TO) = TA) +1 = Oegn) win) = wl) +n = O(n) Gimilian to previous to caleulate w/ pen) Lowtebound on Tint = Rog n) on CREWS PCheW/ © @ Pinker Samp Cherussive Doeblri ) - used traverse / Search dalid dita Schnee a Maled list, reokd direckd trees, graphs f Sti wf tne preter af ay stoke Uist ranking Ce problem: gitn a finbed bit, dobemhe pf cath uf Ws dishace fom Yoo tad (hill off the bit: g- G-6 -G--O>> THe. Nz induy of tard diy 1=0 : ay wf = Meds CREW Piel ism parde hg Mulfpl ~ di) :4/ mit rath ¢h SG) 1= net) Same put... why Sli) # Slay) do. dt) += da) + Abe) St) = StsG) eadobalr ad for = Mlegn) < titry joe L loop He dishne” ine a oh abet @lints) wi) = Olnlagn) < phar iea me oe rs (it sen phnal Siace Segunibl ale Dlr) bine . Belle ways'are Laver) S i 0-00 0-70 030-3 ©5 * @— os Oo @ 6 G SS Sea Se @ Q@ @ @ Can co Sune fhing wf yookd dhvedckl in-bees have a bret of bees + want exch rode to $d root yb free (pent of root in shed self log) tr 144 vd mS fe puatt) Chau Ping whilp $6) +sGuy dr Slt) += SUSG) bt A be helght 4 tallest hee ey eo el ae es! ahs Th) = Oliyh) < ¢ a Wey) = 6 bnlag J, bee : “ly a ir ie ole 5) toe reg. BFS) GF IF Aasired, can pt wb on Cee @ Gb -(ongier at jlo severe Subproblns of elmest wa ee i 7 ia nyt ie a. Soe he v fewucel yn pal b qt 3. Combi ine/| Setubion fo oepual problem. 29. sailed # the pe tuidansnbel problon m fe Y 8 Coprbontl gonad ow a in n ate) m te plen wet milion 4 ooa0oe bl i in oyche connechon order Stgurnbial boity: Olnl an) by Si dide-urd alr Wabi toad lie ag)" Keg eet a feulll Ap bast tn. Sime priatiple 6 lef pre be prin of J wW min emg yx dardnele upper bul => ints Conve Hull of JS ph hh “hb ib 7 (us ), cf) fr } laverkall > points CHS S) hb mn Todi peda! (0) ou gee" = We cn se inthe oh ahs b wee U#G) + L4G) So i) Conshint Time Conve Hull Abboa' nas bot /— any idenbhes cous dull sete = opel. brdhe point 4 in a lone bull Sp 2 external to the tritngh tamed by dng Se 4S. ‘0m tet for peS in Q) ee using (5) -Oly?) precs —CRCW PRAM , ave €S. Ivt + 1 for Convese bull ution + bef! i] whe fel sant tal Conplily - CRca) Pham Tint 80), Work (tpras) Ol"), Oly) for tae p eS tst2 - gives cglic tounchon brde Polat peS a a Conte bell vile 2 7 fp st pen 3 be om oi fp aed He "am fat fo peS in Ol) using On’? procs, ive. fo each pie uae mye fh su if reanaintng print ou Lag ie (wed Cha Pere) Tofel Cmplnibg — Rew Fram Time Oly, Wok (tyres) ln’), On?) fon ta pes OPEN PROBLEW : Compt Conve Rell An 3D port sex dekrministially iw mn myn) tne ‘ ot ) Work gn Ere + random. Ollng) hive, a work (f EW Fly + diode wa Olean) har, 0 (nlogn) Work. (eal a Ran) = dom — Ol logn) bee, Ola! fogn) Work CAwato, Preparatr) © Fact: Can Sot 1% pumbas 1h Olfogr) foe on el PHAN th Usig Haly») wk. Goes fralll rungs tot) Assume no _fuo pls have same LeegeE an n=2* she k, sr Das My xterra , and rename fem ae EP, Pryor tnk._lt_ p2py* gs fn Cetbmest-+ right) Conny fll (8) input: oo a fe w/ reel. tn tntscting. rb —bubpat et re Com 4 ile) b Ine + sehen 2, lef Tne ha, fe they we Pag P DS Compute , (a poll, Wus,) «WJ lon 3. Find upper common be Wty aa ed tay ta thea to fom o Cog ae compet th atreg,) tha fp, wi doe oy may reuse Coxeuseet v Lb dub sunt wail tema i ay i at ot @ A = : eS Ke _ rf ‘ _F 4 . 4 s ; ' tg We ‘ ' ‘e : How! ompute Ue Common Tanpmt? : ° Seguantiol Hechnigia hha Megx) My bnary Starch, SNE + fake midptch of tame _yp bolh. Wh be able thes ist teat Ulf a a => Olly) Heabons 4 Coplay — Time” Tt) = Ti (3) Ally) = Oey) nab bre opal pon (te _ si le Work = Worl meee +0) = Olaky») — wok opbnal (abd) 7” Freprocesig Time Olleqr) 1 Work. Ono n) (ssebrey) Sptadig_up Divide bal Cong Ay . © Brak sie more Subprebime mibally (eases. fgusnbel Ap) ~ tinploead ise parable a4 aes wad a 4. br mat Indl tam co merge vi OO) Ame w/ n proce (CheW) i oO ® Foelo my gprilliras [th tesadeig Aitlesad congas) eg. Sorkuy pr Dey) Doe & Malogn) werk. @ Q Parkihious + break ‘Bohlen up into p Sudproblems af (elmast) 5 + Solve P Sthyroblons Concurrently t : qe lin conkast hb Aide end- conga, most Work tin Pertdmerig hot rn Combintny Shge) Mongeng problem lad! fue socPed anago Alt,,..,4n) + Be (Bb,,..., bn) onfpat: Sorted arg Cp Gnd w/ AB ida $rd vank of turk 4; @B in 2 CB) so the # ells in B Yes than a4; (do Some Ir by Ad, > The posifien of ain C & it rank (am BD. it 3 ? z ¢. ACI) 8+ BIZET rank (4,Yn B) = 0 vank(b, #n Ades rank Caz 108) = 1 vank by in A) = 2 bank Cay, in B) =2 vank (by tnA)=3 tank oe on ne ay aci-a, — clintel, COUD =a C(242) =b, Crd =4, Cs +3) =by fee Ys c= La] [aul fas) bo) @ Sin nal “gin ta Ht of Arba processor dehurnne 6 nk > appropisds array by binary Starch (cRew Pew) Time Oley») Work Oln (ag) < wt ophnal, xy fe t On) Work-ophral parallel alpoiithor O Selutt sveuy logn't ted A i rank tn B MOTE: None 0f “arrows” cross since A+B sorted => Mo hawt Olfay) lish, touk of sie Olay), whase ells wed to be rtrd vanked ( prwise) © Rank the vomaining 5 tn aymropriodt Mist usvig seg. aby. Me eight 0 yy Le) ye We, af vo wl oigh 1 ye bAl 4 Ugh pres oa fe ol, Et) Time Oleg) | Wik = Oleg ify) « Hr) CREW PRAY O Pipe lining Text does ex w/ 2-3 trees - Later we'll do Sov han w/ Pipelining Basic dea Compntaber on Som hee Stuchne - tach Covapntrhion moves up te. level by level from leat fe cost — As one Compnbbion lewes a level , shut neict comput at tet level — $0 Start Compntuh rs seially , but process multiole Gupatahons simlianrouatiy on difleent levels, ’-9. Q . yy 2s 4 & ye a Compute peg. eT AN MA wai o \/\ 1203 5 Zi Tmt 2 32 4 FS 6 + 8B So Tt w/ pipelmon 8 Ti Wo Piteloning 5x4 = 20 @) OAccellerated doseading (b gt ay fast alee) Method fo dombine: ply G) A shw, work-ophmel algorit, a ti) Afshin, re mghed Bota tht ay fo get a Gif A fst work-ophual aberithen, Basix Flea (work) * Start vi/ the Slow, ophnal + uae ct he Pblim Sie fo Sone A vibe + Then uae fol. Subophmal ody on he Salle, Sized pr0blinn (4 will) be eee Bs Size, bat hopehllg casyrgpehia bly plone) fa & orintial 35). &. Finding Maximum g n els. Ala | - oP 4 B Tine Ollegr) Work td Basic Binary te aly ~ build Diaary hee 9a tinpals oO. \ yO lyn Pree S6ed50- 6) © Ay 2 leery) fat, Gry) work-Subyybmep Constant tine Abortion , uses Oh? work. — basic plea’, perform all posite Comparisons input: array A of n distinet els oupat: Booleen anag M sit. Mli)=1 <2 AG) is max of A @) fr l4fen Pardo Mi) += / 4 intt all cHs fo max #7 tnd parde Q@ by /¢€ nyen Pardo Ae On?) itonbous $/ AGj< AG) they Moi) :=O he Aly) is WOE max #/ end pare 6 @ fr Leien pardo if Mae] they mxi= be Ab) is max ¥7 Cha parde Complex ty Tl) = OC) , Whr) = O(n?) CROW > if statement in Shep 2 needs both R+ Cw @Untrhnately., tus aly is f@ work Subophimal +o obtain ged work ophnal abjorthm this a ash... My taste, pork Suboyhrral aly Tint = Qligbeyr) , Work. = Lo daybog es) Based wl arVhurie - YA tree Ae Use| Techie *4/ hoot hao VA childen Uillan Y rot hae Nie children Cfe. Wh 1 assume ph Is & ‘ut haa 2” pa nae chillren 4 pot haw 2% dillon nodes at Lud v have oe ~ hilken (sot feel 6) nthe at Loot K hae 2 children eg. nzl6 o Fick # nodes gh oH boel ZINN | (imeriines Nh Ee AAAANAAA ktt= loglogs +/ Mar Aly Ni lead ape wat lance — binavi olny use conshut hime dt of 1 of inks AL nodoa. Tne = OCleyhag n) Work. ot level i nodes io (wtas') X # [evel i nodes "0 n) = O(2") Tobal Werk. = alevels x Ola) = On loghga) @) Applying Accceatha Cascades 49) O fan binar: fre al: oribun oy h n hs (shu On hee tla 7 ; at cath level reduce # Candidate by fabr of 2. > oth. ne level we've reduce te CantetaTe gehche y F 2°99. lyon He We NOW have h'= OC" s)og) candidal, Time = Oleg be tog >) Wok = OL») @ Run Do logarithmic ovithnn Bary Yemen we a anit 7 “4 7 Time = Ollegleg »') = 0 Ulegl) Wok = OC oghy »!) = OC Naan’ 94s) = Cbs) ShIl CROW singe © needy sf. Lowerbounds Work = Stn) (need b bok at all) Time = St(Loglan) on GREW PRAM (ang mod, C4) Seen) on CREW or EREW Chivarg bee ophul) S Feo 08 lowerlound. > So ALbs are i Remark Fe Max problem, can se Ux ophnoal & Me ro pcs pha Cepranbal > farkhon input sito “Yglogn Yhets of lalgn ebls + Spuchally ‘lhe of be ee, roa) Tia Ol bags) Wore Old? Thon Coub Athre arManic wy pf th Le sents Bigs) de @ Symmetry Beeakinoy 4 be Ching a didid-ogeh &- C8) bf A kcobring of G in a mapping Cc: V> F,y..., esd St. 0) 4 6G) rt Gye€. tok: A egel Can be 3-colred Seuntel Alg to 3 Coby Aireckh « travere cycle and ayn vechces Colors alternabg been Oe/ «we maf rad Haid cob 2) for lest vertoe > ophnal An) bre Sequunbl exprerbal Far’ Gn yply BCA reggenks : ‘ affe the 6) iteratins wt at mest b bobrs Tb)=Lly%) To Brash mn (Sequshi yrowes whl, yeti, oY colrs ee eee > rel 0 3 cebrirg in Clef a] hme, WoL abg)

You might also like