Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling

Size: px
Start display at page:

Download "Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling"

Transcription

1 hptr Intrvl huling Gry Algorithms lis y Kvin Wyn. opyright 00 Prson-Aison Wsly. All rights rsrv. Th originl vrsion n offiil vrsions r t Intrvl huling Intrvl huling: Gry Algorithms Intrvl shuling. Jo j strts t s j n finishs t f j. Two jos omptil if thy on't ovrlp. Gol: fin mximum sust of mutully omptil jos. Gry tmplt. onsir jos in som nturl orr. Tk h jo provi it's omptil with th ons lry tkn. [Erlist strt tim] onsir jos in sning orr of s j. [Erlist finish tim] onsir jos in sning orr of f j. [hortst intrvl] onsir jos in sning orr of f j - s j. [Fwst onflits] For h jo j, ount th numr of onfliting jos j. hul in sning orr of j. f g h Tim

2 Intrvl huling: Gry Algorithms Intrvl huling: Gry Algorithm Gry tmplt. onsir jos in som nturl orr. Tk h jo provi it's omptil with th ons lry tkn. Gry lgorithm. onsir jos in inrsing orr of finish tim. Tk h jo provi it's omptil with th ons lry tkn. ountrxmpl for rlist strt tim ountrxmpl for shortst intrvl ountrxmpl for fwst onflits ort jos y finish tims so tht f f... f n. st of jos slt A for j = to n { if (jo j omptil with A) A A {j} } rturn A Implmnttion. O(n log n). Rmmr jo j* tht ws lst to A. Jo j is omptil with A if s j f j*. 6 Intrvl huling: Anlysis Intrvl huling: Anlysis Thorm. Gry lgorithm is optiml. Thorm. Gry lgorithm is optiml. Pf. (y ontrition) Assum gry is not optiml, n lt's s wht hppns. Lt i, i,... i k not st of jos slt y gry. Lt j, j,... j m not st of jos in th optiml solution with i = j, i = j,..., i r = j r for th lrgst possil vlu of r. Pf. (y ontrition) Assum gry is not optiml, n lt's s wht hppns. Lt i, i,... i k not st of jos slt y gry. Lt j, j,... j m not st of jos in th optiml solution with i = j, i = j,..., i r = j r for th lrgst possil vlu of r. jo i r+ finishs for j r+ jo i r+ finishs for j r+ Gry: i i i r i r+ Gry: i i i r i r+ OPT: j j j r j r+... OPT: j j j r i r+... why not rpl jo j r+ with jo i r+? solution still fsil n optiml, ut ontrits mximlity of r. 7 8

3 Intrvl Prtitioning Intrvl Prtitioning Intrvl prtitioning. Ltur j strts t s j n finishs t f j. Gol: fin minimum numr of lssrooms to shul ll lturs so tht no two our t th sm tim in th sm room. Ex: This shul uss lssrooms to shul 0 lturs. j g h f i 9 9:0 0 0:0 :0 :0 :0 :0 :0 :0 Tim 0 Intrvl Prtitioning Intrvl Prtitioning: Lowr Boun on Optiml olution Intrvl prtitioning. Ltur j strts t s j n finishs t f j. Gol: fin minimum numr of lssrooms to shul ll lturs so tht no two our t th sm tim in th sm room. Df. Th pth of st of opn intrvls is th mximum numr tht ontin ny givn tim. Ky osrvtion. Numr of lssrooms n pth. Ex: This shul uss only. Ex: Dpth of shul low = shul low is optiml.,, ll ontin 9:0 Q. Dos thr lwys xist shul qul to pth of intrvls? f j f j g i g i h h 9 9:0 0 0:0 :0 :0 :0 :0 :0 :0 Tim 9 9:0 0 0:0 :0 :0 :0 :0 :0 :0 Tim

4 Intrvl Prtitioning: Gry Algorithm Intrvl Prtitioning: Gry Anlysis Gry lgorithm. onsir lturs in inrsing orr of strt tim: ssign ltur to ny omptil lssroom. ort intrvls y strting tim so tht s s... s n. 0 numr of llot lssrooms for j = to n { if (ltur j is omptil with som lssroom k) shul ltur j in lssroom k ls llot nw lssroom + shul ltur j in lssroom + + } Implmnttion. O(n log n). For h lssroom k, mintin th finish tim of th lst jo. Kp th lssrooms in priority quu. Osrvtion. Gry lgorithm nvr shuls two inomptil lturs in th sm lssroom. Thorm. Gry lgorithm is optiml. Pf. Lt = numr of lssrooms tht th gry lgorithm llots. lssroom is opn us w n to shul jo, sy j, tht is inomptil with ll - othr lssrooms. Ths jos h n ftr s j. in w sort y strt tim, ll ths inomptiilitis r us y lturs tht strt no ltr thn s j. Thus, w hv lturs ovrlpping t tim s j +. Ky osrvtion ll shuls us lssrooms. huling to Minimizing Ltnss huling to Minimiz Ltnss Minimizing ltnss prolm. ingl rsour prosss on jo t tim. Jo j rquirs t j units of prossing tim n is u t tim j. If j strts t tim s j, it finishs t tim f j = s j + t j. Ltnss: j = mx { 0, f j - j }. Gol: shul ll jos to minimiz mximum ltnss L = mx j. Ex: t j 6 j ltnss = ltnss = 0 mx ltnss = 6 = 9 = 8 6 = = 6 = =

5 Minimizing Ltnss: Gry Algorithms Minimizing Ltnss: Gry Algorithms Gry tmplt. onsir jos in som orr. Gry tmplt. onsir jos in som orr. [hortst prossing tim first] onsir jos in sning orr of prossing tim t j. [hortst prossing tim first] onsir jos in sning orr of prossing tim t j. [Erlist lin first] onsir jos in sning orr of lin j. t j 00 j 0 0 ountrxmpl [mllst slk] onsir jos in sning orr of slk j - t j. [mllst slk] onsir jos in sning orr of slk j - t j. t j j 0 0 ountrxmpl 7 8 Minimizing Ltnss: Gry Algorithm Minimizing Ltnss: No Il Tim Gry lgorithm. Erlist lin first. Osrvtion. Thr xists n optiml shul with no il tim. ort n jos y lin so tht n = = = t 0 for j = to n Assign jo j to intrvl [t, t + t j ] s j t, f j t + t j t t + t j output intrvls [s j, f j ] = = 6 = Osrvtion. Th gry shul hs no il tim. mx ltnss = = 6 = 8 = 9 = 9 = 6 =

6 Minimizing Ltnss: Invrsions Minimizing Ltnss: Invrsions Df. Givn shul, n invrsion is pir of jos i n j suh tht: i < j ut j shul for i. invrsion f i Df. Givn shul, n invrsion is pir of jos i n j suh tht: i < j ut j shul for i. invrsion f i for swp j i for swp j i [ s for, w ssum jos r numr so tht n ] ftr swp i j f' j Osrvtion. Gry shul hs no invrsions. Osrvtion. If shul (with no il tim) hs n invrsion, it hs on with pir of invrt jos shul onsutivly. lim. wpping two onsutiv, invrt jos rus th numr of invrsions y on n os not inrs th mx ltnss. Pf. Lt th ltnss for th swp, n lt ' it ftrwrs. ' k = k for ll k i, j ' i i If jo j is lt: j f j j f i j (finition) (j finishs t tim f i ) f i i (i j) i (finition) Minimizing Ltnss: Anlysis of Gry Algorithm Gry Anlysis trtgis Thorm. Gry shul is optiml. Pf. Dfin * to n optiml shul tht hs th fwst numr of invrsions, n lt's s wht hppns. n ssum * hs no il tim. If * hs no invrsions, thn = *. If * hs n invrsion, lt i-j n jnt invrsion. swpping i n j os not inrs th mximum ltnss n stritly rss th numr of invrsions this ontrits finition of * Gry lgorithm stys h. how tht ftr h stp of th gry lgorithm, its solution is t lst s goo s ny othr lgorithm's. truturl. Disovr simpl "struturl" oun ssrting tht vry possil solution must hv rtin vlu. Thn show tht your lgorithm lwys hivs this oun. Exhng rgumnt. Grully trnsform ny solution to th on foun y th gry lgorithm without hurting its qulity. Othr gry lgorithms. Kruskl, Prim, Dijkstr, Huffmn,

7 Optiml Offlin hing Optiml hing hing. h with pity to stor k itms. qun of m itm rqusts,,, m. h hit: itm lry in h whn rqust. h miss: itm not lry in h whn rqust: must ring rqust itm into h, n vit som xisting itm, if full. Gol. Evition shul tht minimizs numr of h misss. Ex: k =, initil h =, rqusts:,,,,,,,. Optiml vition shul: h misss. r = h miss rqusts h 6 Optiml Offlin hing: Frthst-In-Futur Ru Evition huls Frthst-in-futur. Evit itm in th h tht is not rqust until frthst in th futur. Df. A ru shul is shul tht only insrts n itm into th h in stp in whih tht itm is rqust. urrnt h: f Intuition. n trnsform n unru shul into ru on with no mor h misss. futur quris: g f f g h... h miss jt this on Thorm. [Blly, 960s] FF is optiml vition shul. Pf. Algorithm n thorm r intuitiv; proof is sutl. x x n unru shul ru shul 7 8

8 Ru Evition huls Frthst-In-Futur: Anlysis lim. Givn ny unru shul, n trnsform it into ru shul ' with no mor h misss. Pf. (y inution on numr of unru itms) uppos rings into th h t tim t, without rqust. Lt th itm vits whn it rings into th h. s : vit t tim t', for nxt rqust for. s : rqust t tim t' for is vit. t t' t t' vit t tim t', for nxt rqust ' t t' osn't ntr h t rqust tim t t' rqust t tim t' ' Thorm. FF is optiml vition lgorithm. Pf. (y inution on numr or rqusts j) Invrint: Thr xists n optiml ru shul tht mks th sm vition shul s FF through th first j+ rqusts. Lt ru shul tht stisfis invrint through j rqusts. W prou ' tht stisfis invrint ftr j+ rqusts. onsir (j+) st rqust = j+. in n FF hv gr up until now, thy hv th sm h ontnts for rqust j+. s : ( is lry in th h). ' = stisfis invrint. s : ( is not in th h n n FF vit th sm lmnt). ' = stisfis invrint. s s 9 0 Frthst-In-Futur: Anlysis Frthst-In-Futur: Anlysis Pf. (ontinu) s : ( is not in th h; FF vits ; vits f ). gin onstrution of ' from y viting inst of f j sm f sm f j+ j sm sm f now ' grs with FF on first j+ rqusts; w show tht hving lmnt f in h is no wors thn hving lmnt ' ' Lt j' th first tim ftr j+ tht n ' tk iffrnt tion, n lt g itm rqust t tim j'. j' s : g =. n't hppn with Frthst-In-Futur sin thr must rqust for f for. s : g = f. Elmnt f n't in h of, so lt ' th lmnt tht vits. if ' =, ' sss f from h; now n ' hv sm h if ', ' vits ' n rings into th h; now n ' hv th sm h sm sm f must involv or f (or oth) ' Not: ' is no longr ru, ut n trnsform into ru shul tht grs with FF through stp j+

9 Frthst-In-Futur: Anlysis hing Prsptiv Lt j' th first tim ftr j+ tht n ' tk iffrnt tion, n lt g itm rqust t tim j'. j' sm sm f must involv or f (or oth) Onlin vs. offlin lgorithms. Offlin: full squn of rqusts is known priori. Onlin (rlity): rqusts r not known in vn. hing is mong most funmntl onlin prolms in. ' s : g, f. must vit. Mk ' vit f; now n ' hv th sm h. j' othrwis ' woul tk th sm tion sm g sm g ' LIFO. Evit pg rought in most rntly. LRU. Evit pg whos most rnt ss ws rlist. Thorm. FF is optiml offlin vition lgorithm. Provis sis for unrstning n nlyzing onlin lgorithms. LRU is k-omptitiv. [tion.8] LIFO is ritrrily. FF with irtion of tim rvrs! lting Brkpoints lting Brkpoints lting rkpoints. Ro trip from Printon to Plo Alto long fix rout. Rfuling sttions t rtin points long th wy. Ful pity =. Gol: mks s fw rfuling stops s possil. Gry lgorithm. Go s fr s you n for rfuling. Printon Plo Alto 6 7 6

10 lting Brkpoints: Gry Algorithm lting Brkpoints: orrtnss Truk rivr's lgorithm. Thorm. Gry lgorithm is optiml. ort rkpoints so tht: 0 = 0 < < <... < n = L {0} x 0 rkpoints slt urrnt lotion whil (x n ) lt p lrgst intgr suh tht p x + if ( p = x) rturn "no solution" x p {p} rturn Gry: Pf. (y ontrition) Assum gry is not optiml, n lt's s wht hppns. Lt 0 = g 0 < g <... < g p = L not st of rkpoints hosn y gry. Lt 0 = f 0 < f <... < f q = L not st of rkpoints in n optiml solution with f 0 = g 0, f = g,..., f r = g r for lrgst possil vlu of r. Not: g r+ > f r+ y gry hoi of lgorithm. g 0 g g g r g r+ Implmnttion. O(n log n) Us inry srh to slt h rkpoint p. OPT: f 0 f f f r f q why osn't optiml solution riv littl furthr? f r lting Brkpoints: orrtnss Thorm. Gry lgorithm is optiml. Pf. (y ontrition) Assum gry is not optiml, n lt's s wht hppns. Lt 0 = g 0 < g <... < g p = L not st of rkpoints hosn y gry. Lt 0 = f 0 < f <... < f q = L not st of rkpoints in n optiml solution with f 0 = g 0, f = g,..., f r = g r for lrgst possil vlu of r. Not: g r+ > f r+ y gry hoi of lgorithm. oin hnging Gry: g 0 g g g r g r+ OPT:... f 0 f f f r f q nothr optiml solution hs on mor rkpoint in ommon ontrition 9

11 oin hnging oin-hnging: Gry Algorithm Gol. Givn urrny nomintions:,, 0,, 00, vis mtho to py mount to ustomr using fwst numr of oins. shir's lgorithm. At h itrtion, oin of th lrgst vlu tht os not tk us pst th mount to pi. Ex:. ort oins nomintions y vlu: < < < n. oins slt shir's lgorithm. At h itrtion, oin of th lrgst vlu tht os not tk us pst th mount to pi. Ex: $.89. whil (x 0) { lt k lrgst intgr suh tht k x if (k = 0) rturn "no solution foun" x x - k {k} } rturn Q. Is shir's lgorithm optiml? Proprtis of optiml solution oin-hnging: Anlysis of Gry Algorithm Proprty. Pf. Rpl pnnis with nikl. Proprty. Proprty. Proprty. Pf. Rpl ims n 0 nikls with qurtr n nikl; Rpl ims n nikl with qurtr. Rll: t most nikl. pnny= nikl= im=0 qurtr= Thorm. Gry lgorithm is optiml for U.. oing:,, 0,, 00. Pf. (y inution on x) onsir optiml wy to hng k x < k+ : gry tks oin k. W lim tht ny optiml solution must lso tk oin k. if not, it ns nough oins of typ,, k- to up to x tl low inits no optiml solution n o this Prolm rus to oin-hnging x - k nts, whih, y inution, is optimlly solv y gry lgorithm. k k All optiml solutions must stisfy P Mx vlu of oins,,, k- in ny OPT - N 0 N + D + = 9 Q 0 + = 00 no limit 7 + = 99

12 Is shir's lgorithm for ny st of nomintions? Osrvtion. Gry lgorithm is su-optiml for U postl nomintions:, 0,,, 70, 00, 0,, 00. Minimum pnning Tr ountrxmpl. 0. Gry: 00,,,,,,,. Optiml: 70, 70. Osrvtion. It my not vn l to fsil solution if > : 7, 8, 9. shir's lgorithm: = 9 +???. Optiml: = Minimum pnning Tr Applitions Minimum spnning tr. Givn onnt grph G = (V, E) with rlvlu g wights, n MT is sust of th gs T E suh tht T is spnning tr whos sum of g wights is minimiz. MT is funmntl prolm with ivrs pplitions. Ntwork sign. tlphon, ltril, hyruli, TV l, omputr, ro Approximtion lgorithms for NP-hr prolms. trvling slsprson prolm, tinr tr G = (V, E) T, T = Inirt pplitions. mx ottlnk pths LDP os for rror orrtion img rgistrtion with Rnyi ntropy lrning slint fturs for rl-tim f vrifition ruing t storg in squning mino is in protin mol lolity of prtil intrtions in turulnt flui flows utoonfig protool for Ethrnt riging to voi yls in ntwork yly's Thorm. Thr r n n- spnning trs of K n. lustr nlysis. n't solv y rut for 7 8

13 Gry Algorithms Gry Algorithms Kruskl's lgorithm. trt with T =. onsir gs in sning orr of ost. Insrt g in T unlss oing so woul rt yl. Rvrs-Dlt lgorithm. trt with T = E. onsir gs in sning orr of ost. Dlt g from T unlss oing so woul isonnt T. Prim's lgorithm. trt with som root no s n grily grow tr T from s outwr. At h stp, th hpst g to T tht hs xtly on npoint in T. implifying ssumption. All g osts r istint. ut proprty. Lt ny sust of nos, n lt th min ost g with xtly on npoint in. Thn th MT ontins. yl proprty. Lt ny yl, n lt f th mx ost g longing to. Thn th MT os not ontin f. f Rmrk. All thr lgorithms prou n MT. is in th MT f is not in th MT 9 0 yls n uts yl-ut Intrstion yl. t of gs th form -, -, -,, y-z, z-. lim. A yl n utst intrst in n vn numr of gs. 6 yl = -, -, -, -, -6, 6-6 yl = -, -, -, -, -6, 6- utst D = -, -, -6, -7, 7-8 Intrstion = -, utst. A ut is sust of nos. Th orrsponing utst D is th sust of gs with xtly on npoint in. 6 ut = {,, 8 } utst D = -6, -7, -, -, 7-8 Pf. (y pitur) V - 7 8

14 Gry Algorithms Gry Algorithms implifying ssumption. All g osts r istint. implifying ssumption. All g osts r istint. ut proprty. Lt ny sust of nos, n lt th min ost g with xtly on npoint in. Thn th MT T* ontins. yl proprty. Lt ny yl in G, n lt f th mx ost g longing to. Thn th MT T* os not ontin f. Pf. (xhng rgumnt) uppos os not long to T*, n lt's s wht hppns. Aing to T* rts yl in T*. Eg is oth in th yl n in th utst D orrsponing to thr xists nothr g, sy f, tht is in oth n D. T' = T* { } - { f } is lso spnning tr. in < f, ost(t') < ost(t*). This is ontrition. f Pf. (xhng rgumnt) uppos f longs to T*, n lt's s wht hppns. Dlting f from T* rts ut in T*. Eg f is oth in th yl n in th utst D orrsponing to thr xists nothr g, sy, tht is in oth n D. T' = T* { } - { f } is lso spnning tr. in < f, ost(t') < ost(t*). This is ontrition. f T* T* Prim's Algorithm: Proof of orrtnss Implmnttion: Prim's Algorithm Prim's lgorithm. [Jrník 90, Dijkstr 97, Prim 99] Initiliz = ny no. Apply ut proprty to. A min ost g in utst orrsponing to to T, n on nw xplor no u to. Implmnttion. Us priority quu. Mintin st of xplor nos. For h unxplor no v, mintin tthmnt ost [v] = ost of hpst g v to no in. O(n ) with n rry; O(m log n) with inry hp. Prim(G, ) { forh (v V) [v] Initiliz n mpty priority quu Q forh (v V) insrt v onto Q Initiliz st of xplor nos } whil (Q is not mpty) { u lt min lmnt from Q { u } forh (g = (u, v) inint to u) if ((v ) n ( < [v])) rs priority [v] to 6

15 Kruskl's Algorithm: Proof of orrtnss Implmnttion: Kruskl's Algorithm Kruskl's lgorithm. [Kruskl, 96] onsir gs in sning orr of wight. s : If ing to T rts yl, isr oring to yl proprty. s : Othrwis, insrt = (u, v) into T oring to ut proprty whr = st of nos in u's onnt omponnt. Implmnttion. Us th union-fin t strutur. Buil st T of gs in th MT. Mintin st for h onnt omponnt. O(m log n) for sorting n O(m (m, n)) for union-fin. m n log m is O(log n) ssntilly onstnt Kruskl(G, ) { ort gs wights so tht... m. T forh (u V) mk st ontining singlton u s v u s } for i = to m (u,v) = i if (u n v r in iffrnt sts) { T T { i } mrg th sts ontining u n v } mrg two omponnts rturn T r u n v in iffrnt onnt omponnts? 7 8 Lxiogrphi Tirking MT Algorithms: Thory To rmov th ssumption tht ll g osts r istint: prtur ll g osts y tiny mounts to rk ny tis. Impt. Kruskl n Prim only intrt with osts vi pirwis omprisons. If prturtions r suffiintly smll, MT with prtur osts is MT with originl osts..g., if ll g osts r intgrs, prturing ost of g i y i / n Implmnttion. n hnl ritrrily smll prturtions impliitly y rking tis lxiogrphilly, oring to inx. ooln lss(i, j) { if (ost( i ) < ost( j )) rturn tru ls if (ost( i ) > ost( j )) rturn fls ls if (i < j) rturn tru ls rturn fls } Dtrministi omprison s lgorithms. O(m log n) [Jrník, Prim, Dijkstr, Kruskl, Boruvk] O(m log log n). [hriton-trjn 976, Yo 97] O(m (m, n)). [Frmn-Trjn 987] O(m log (m, n)). [Gow-Glil-pnr-Trjn 986] O(m (m, n)). [hzll 000] Holy gril. O(m). Notl. O(m) rnomiz. [Krgr-Klin-Trjn 99] O(m) vrifition. [Dixon-Ruh-Trjn 99] Eulin. -: O(n log n). omput MT of gs in Dluny k-: O(k n ). ns Prim 9 60

16 lustring lustring lustring. Givn st U of n ojts ll p,, p n, lssify into ohrnt groups. photos, oumnts. miro-orgnisms Distn funtion. Numri vlu spifying "losnss" of two ojts. numr of orrsponing pixls whos intnsitis iffr y som thrshol Funmntl prolm. Divi into lustrs so tht points in iffrnt lustrs r fr prt. Routing in moil ho ntworks. Intify pttrns in gn xprssion. Doumnt tgoriztion for w srh. imilrity srhing in mil img tss kyt: lustr 0 9 sky ojts into strs, qusrs, glxis. 6 lustring of Mximum ping Gry lustring Algorithm k-lustring. Divi ojts into k non-mpty groups. Distn funtion. Assum it stisfis svrl nturl proprtis. (p i, p j ) = 0 iff p i = p j (intity of inisrnils) (p i, p j ) 0 (nonngtivity) (p i, p j ) = (p j, p i ) (symmtry) ping. Min istn twn ny pir of points in iffrnt lustrs. ingl-link k-lustring lgorithm. Form grph on th vrtx st U, orrsponing to n lustrs. Fin th losst pir of ojts suh tht h ojt is in iffrnt lustr, n n g twn thm. Rpt n-k tims until thr r xtly k lustrs. Ky osrvtion. This prour is prisly Kruskl's lgorithm (xpt w stop whn thr r k onnt omponnts). lustring of mximum sping. Givn n intgr k, fin k-lustring of mximum sping. Rmrk. Equivlnt to fining n MT n lting th k- most xpnsiv gs. sping k = 6 6

17 Gry lustring Algorithm: Anlysis Thorm. Lt * not th lustring *,, * k form y lting th k- most xpnsiv gs of MT. * is k-lustring of mx sping. Gr is goo. Pf. Lt not som othr lustring,, k. Th sping of * is th lngth * of th (k-) st most xpnsiv g. Lt p i, p j in th sm lustr in *, sy * r, ut iffrnt lustrs in, sy s n t. om g (p, q) on p i -p j pth in * r spns two iffrnt lustrs in. All gs on p i -p j pth hv lngth * sin Kruskl hos thm. ping of is * sin p n q r in iffrnt lustrs. * r s t Gr is right. Gr works. Gr lrifis, uts through, n pturs th ssn of th volutionry spirit. - Goron Gko (Mihl Dougls) p i p q p j 6 66

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

CSC Design and Analysis of Algorithms. Example: Change-Making Problem CSC 801- Dsign n Anlysis of Algorithms Ltur 11 Gry Thniqu Exmpl: Chng-Mking Prolm Givn unlimit mounts of oins of nomintions 1 > > m, giv hng for mount n with th lst numr of oins Exmpl: 1 = 25, 2 =10, =

More information

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V Unirt Grphs An unirt grph G = (V, E) V st o vrtis E st o unorr gs (v,w) whr v, w in V USE: to mol symmtri rltionships twn ntitis vrtis v n w r jnt i thr is n g (v,w) [or (w,v)] th g (v,w) is inint upon

More information

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling.

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling. Cptr 4 4 Intrvl Suln Gry Alortms Sls y Kvn Wyn Copyrt 005 Prson-Ason Wsly All rts rsrv Intrvl Suln Intrvl Suln: Gry Alortms Intrvl suln! Jo strts t s n nss t! Two os omptl ty on't ovrlp! Gol: n mxmum sust

More information

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs. Pths.. Eulr n Hmilton Pths.. Pth D. A pth rom s to t is squn o gs {x 0, x 1 }, {x 1, x 2 },... {x n 1, x n }, whr x 0 = s, n x n = t. D. Th lngth o pth is th numr o gs in it. {, } {, } {, } {, } {, } {,

More information

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018 CSE 373: Mor on grphs; DFS n BFS Mihl L Wnsy, F 14, 2018 1 Wrmup Wrmup: Disuss with your nighor: Rmin your nighor: wht is simpl grph? Suppos w hv simpl, irt grph with x nos. Wht is th mximum numr of gs

More information

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)} Introution Computr Sin & Enginring 423/823 Dsign n Anlysis of Algorithms Ltur 03 Elmntry Grph Algorithms (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) I Grphs r strt t typs tht r pplil to numrous

More information

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)} s s of s Computr Sin & Enginring 423/823 Dsign n Anlysis of Ltur 03 (Chptr 22) Stphn Sott (Apt from Vinohnrn N. Vriym) s of s s r strt t typs tht r pplil to numrous prolms Cn ptur ntitis, rltionships twn

More information

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s? MATH 3012 Finl Exm, My 4, 2006, WTT Stunt Nm n ID Numr 1. All our prts o this prolm r onrn with trnry strings o lngth n, i.., wors o lngth n with lttrs rom th lpht {0, 1, 2}.. How mny trnry wors o lngth

More information

CS200: Graphs. Graphs. Directed Graphs. Graphs/Networks Around Us. What can this represent? Sometimes we want to represent directionality:

CS200: Graphs. Graphs. Directed Graphs. Graphs/Networks Around Us. What can this represent? Sometimes we want to represent directionality: CS2: Grphs Prihr Ch. 4 Rosn Ch. Grphs A olltion of nos n gs Wht n this rprsnt? n A omputr ntwork n Astrtion of mp n Soil ntwork CS2 - Hsh Tls 2 Dirt Grphs Grphs/Ntworks Aroun Us A olltion of nos n irt

More information

COMP108 Algorithmic Foundations

COMP108 Algorithmic Foundations Grdy mthods Prudn Wong http://www.s.liv..uk/~pwong/thing/omp108/01617 Coin Chng Prolm Suppos w hv 3 typs of oins 10p 0p 50p Minimum numr of oins to mk 0.8, 1.0, 1.? Grdy mthod Lrning outoms Undrstnd wht

More information

Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2

Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2 Grt Thortil Is In Computr Sin Vitor Amhik CS 15-251 Ltur 9 Grphs - II Crngi Mllon Univrsity Grph Isomorphism finition. Two simpl grphs G n H r isomorphi G H if thr is vrtx ijtion V H ->V G tht prsrvs jny

More information

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura Moul grph.py CS 231 Nomi Nishimur 1 Introution Just lik th Python list n th Python itionry provi wys of storing, ssing, n moifying t, grph n viw s wy of storing, ssing, n moifying t. Bus Python os not

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Chptr. Intrvl Shulng Gry Algorthms Sls y Kvn Wyn. Copyrght 005 Prson-Ason Wsly. All rghts rsrv. Intrvl Shulng Intrvl Shulng: Gry Algorthms Intrvl shulng. Jo strts t s n fnshs t f. Two os omptl f thy on't

More information

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp CSE 373 Grphs 1: Conpts, Dpth/Brth-First Srh ring: Wiss Ch. 9 slis rt y Mrty Stpp http://www.s.wshington.u/373/ Univrsity o Wshington, ll rights rsrv. 1 Wht is grph? 56 Tokyo Sttl Soul 128 16 30 181 140

More information

CS 241 Analysis of Algorithms

CS 241 Analysis of Algorithms CS 241 Anlysis o Algorithms Prossor Eri Aron Ltur T Th 9:00m Ltur Mting Lotion: OLB 205 Businss HW6 u lry HW7 out tr Thnksgiving Ring: Ch. 22.1-22.3 1 Grphs (S S. B.4) Grphs ommonly rprsnt onntions mong

More information

CS 461, Lecture 17. Today s Outline. Example Run

CS 461, Lecture 17. Today s Outline. Example Run Prim s Algorithm CS 461, Ltur 17 Jr Si Univrsity o Nw Mxio In Prim s lgorithm, th st A mintin y th lgorithm orms singl tr. Th tr strts rom n ritrry root vrtx n grows until it spns ll th vrtis in V At h

More information

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013 CS Avn Dt Struturs n Algorithms Exm Solution Jon Turnr //. ( points) Suppos you r givn grph G=(V,E) with g wights w() n minimum spnning tr T o G. Now, suppos nw g {u,v} is to G. Dsri (in wors) mtho or

More information

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph Intrntionl J.Mth. Comin. Vol.1(2014), 80-86 Algorithmi n NP-Compltnss Aspts of Totl Lit Domintion Numr of Grph Girish.V.R. (PES Institut of Thnology(South Cmpus), Bnglor, Krntk Stt, Ini) P.Ush (Dprtmnt

More information

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12 Aministrivi: CS61B Ltur #33 Autogrr will run this vning. Toy s Rings: Grph Struturs: DSIJ, Chptr 12 Lst moifi: W Nov 8 00:39:28 2017 CS61B: Ltur #33 1 Why Grphs? For xprssing non-hirrhilly rlt itms Exmpls:

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design nd Anlysis LECTURE 8 Mx. lteness ont d Optiml Ching Adm Smith 9/12/2008 A. Smith; sed on slides y E. Demine, C. Leiserson, S. Rskhodnikov, K. Wyne Sheduling to Minimizing Lteness Minimizing

More information

CSE 373: AVL trees. Warmup: Warmup. Interlude: Exploring the balance invariant. AVL Trees: Invariants. AVL tree invariants review

CSE 373: AVL trees. Warmup: Warmup. Interlude: Exploring the balance invariant. AVL Trees: Invariants. AVL tree invariants review rmup CSE 7: AVL trs rmup: ht is n invrint? Mihl L Friy, Jn 9, 0 ht r th AVL tr invrints, xtly? Disuss with your nighor. AVL Trs: Invrints Intrlu: Exploring th ln invrint Cor i: xtr invrint to BSTs tht

More information

Outline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs

Outline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim s Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #34 Introution Min-Cost Spnnin Trs 3 Gnrl Constrution 4 5 Trmintion n Eiiny 6 Aitionl

More information

12. Traffic engineering

12. Traffic engineering lt2.ppt S-38. Introution to Tltrffi Thory Spring 200 2 Topology Pths A tlommunition ntwork onsists of nos n links Lt N not th st of nos in with n Lt J not th st of nos in with j N = {,,,,} J = {,2,3,,2}

More information

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example Outlin Computr Sin 33 Computtion o Minimum-Cost Spnnin Trs Prim's Alorithm Introution Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #33 3 Alorithm Gnrl Constrution Mik Joson (Univrsity o Clry)

More information

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes. Nm: UCA ID Numr: Stion lttr: th 61 : Disrt Struturs Finl Exm Instrutor: Ciprin nolsu You hv 180 minuts. No ooks, nots or lultors r llow. Do not us your own srth ppr. 1. (2 points h) Tru/Fls: Cirl th right

More information

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem) 12/3/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 Ciruits Cyl 2 Eulr

More information

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs Prt 10. Grphs CS 200 Algorithms n Dt Struturs 1 Introution Trminology Implmnting Grphs Outlin Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 2 Ciruits Cyl A spil yl

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design nd Anlysis LECTURE 5 Supplement Greedy Algorithms Cont d Minimizing lteness Ching (NOT overed in leture) Adm Smith 9/8/10 A. Smith; sed on slides y E. Demine, C. Leiserson, S. Rskhodnikov,

More information

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008 Th Univrsity o Syny MATH2969/2069 Grph Thory Tutoril 5 (Wk 12) Solutions 2008 1. (i) Lt G th isonnt plnr grph shown. Drw its ul G, n th ul o th ul (G ). (ii) Show tht i G is isonnt plnr grph, thn G is

More information

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1. Why th Juntion Tr lgorithm? Th Juntion Tr lgorithm hris Willims 1 Shool of Informtis, Univrsity of Einurgh Otor 2009 Th JT is gnrl-purpos lgorithm for omputing (onitionl) mrginls on grphs. It os this y

More information

Weighted graphs -- reminder. Data Structures LECTURE 15. Shortest paths algorithms. Example: weighted graph. Two basic properties of shortest paths

Weighted graphs -- reminder. Data Structures LECTURE 15. Shortest paths algorithms. Example: weighted graph. Two basic properties of shortest paths Dt Strutur LECTURE Shortt pth lgorithm Proprti of hortt pth Bllmn-For lgorithm Dijktr lgorithm Chptr in th txtook (pp ). Wight grph -- rminr A wight grph i grph in whih g hv wight (ot) w(v i, v j ) >.

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spnning Trs Minimum Spnning Trs Problm A town hs st of houss nd st of rods A rod conncts nd only houss A rod conncting houss u nd v hs rpir cost w(u, v) Gol: Rpir nough (nd no mor) rods such tht:

More information

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari Grphs CSC 1300 Disrt Struturs Villnov Univrsity Grphs Grphs r isrt struturs onsis?ng of vr?s n gs tht onnt ths vr?s. Grphs n us to mol: omputr systms/ntworks mthm?l rl?ons logi iruit lyout jos/prosss f

More information

Section 10.4 Connectivity (up to paths and isomorphism, not including)

Section 10.4 Connectivity (up to paths and isomorphism, not including) Toy w will isuss two stions: Stion 10.3 Rprsnting Grphs n Grph Isomorphism Stion 10.4 Conntivity (up to pths n isomorphism, not inluing) 1 10.3 Rprsnting Grphs n Grph Isomorphism Whn w r working on n lgorithm

More information

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem) 4/25/12 Outlin Prt 10. Grphs CS 200 Algorithms n Dt Struturs Introution Trminology Implmnting Grphs Grph Trvrsls Topologil Sorting Shortst Pths Spnning Trs Minimum Spnning Trs Ciruits 1 2 Eulr s rig prolm

More information

GREEDY TECHNIQUE. Greedy method vs. Dynamic programming method:

GREEDY TECHNIQUE. Greedy method vs. Dynamic programming method: Dinition: GREEDY TECHNIQUE Gry thniqu is gnrl lgorithm sign strtgy, uilt on ollowing lmnts: onigurtions: irnt hois, vlus to in ojtiv untion: som onigurtions to ithr mximiz or minimiz Th mtho: Applil to

More information

Announcements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk

Announcements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk Grphs & Grph Algorithms Ltur CS Spring 6 Announmnts A6 rls toy: Risk Strt signing with your prtnr sp Prlim usy Not grphs hs r Grphs K 5 K, =...not th kin w mn, nywy Applitions o Grphs Communition ntworks

More information

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1 CSC 00 Disrt Struturs : Introuon to Grph Thory Grphs Grphs CSC 00 Disrt Struturs Villnov Univrsity Grphs r isrt struturs onsisng o vrs n gs tht onnt ths vrs. Grphs n us to mol: omputr systms/ntworks mthml

More information

Constructive Geometric Constraint Solving

Constructive Geometric Constraint Solving Construtiv Gomtri Constrint Solving Antoni Soto i Rir Dprtmnt Llngutgs i Sistms Inormàtis Univrsitt Politèni Ctluny Brlon, Sptmr 2002 CGCS p.1/37 Prliminris CGCS p.2/37 Gomtri onstrint prolm C 2 D L BC

More information

Planar Upward Drawings

Planar Upward Drawings C.S. 252 Pro. Rorto Tmssi Computtionl Gomtry Sm. II, 1992 1993 Dt: My 3, 1993 Sri: Shmsi Moussvi Plnr Upwr Drwings 1 Thorm: G is yli i n only i it hs upwr rwing. Proo: 1. An upwr rwing is yli. Follow th

More information

Problem solving by search

Problem solving by search Prolm solving y srh Tomáš voo Dprtmnt o Cyrntis, Vision or Roots n Autonomous ystms Mrh 5, 208 / 3 Outlin rh prolm. tt sp grphs. rh trs. trtgis, whih tr rnhs to hoos? trtgy/algorithm proprtis? Progrmming

More information

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem Thorm 10-1: Th Hnshkin Thorm Lt G=(V,E) n unirt rph. Thn Prt 10. Grphs CS 200 Alorithms n Dt Struturs v V (v) = 2 E How mny s r thr in rph with 10 vrtis h of r six? 10 * 6 /2= 30 1 Thorm 10-2 An unirt

More information

Numbering Boundary Nodes

Numbering Boundary Nodes Numring Bounry Nos Lh MBri Empori Stt Univrsity August 10, 2001 1 Introution Th purpos of this ppr is to xplor how numring ltril rsistor ntworks ffts thir rspons mtrix, Λ. Morovr, wht n lrn from Λ out

More information

1 Introduction to Modulo 7 Arithmetic

1 Introduction to Modulo 7 Arithmetic 1 Introution to Moulo 7 Arithmti Bor w try our hn t solvin som hr Moulr KnKns, lt s tk los look t on moulr rithmti, mo 7 rithmti. You ll s in this sminr tht rithmti moulo prim is quit irnt rom th ons w

More information

Greedy Algorithms, Activity Selection, Minimum Spanning Trees Scribes: Logan Short (2015), Virginia Date: May 18, 2016

Greedy Algorithms, Activity Selection, Minimum Spanning Trees Scribes: Logan Short (2015), Virginia Date: May 18, 2016 Ltur 4 Gry Algorithms, Ativity Sltion, Minimum Spnning Trs Sris: Logn Short (5), Virgini Dt: My, Gry Algorithms Suppos w wnt to solv prolm, n w r l to om up with som rursiv ormultion o th prolm tht woul

More information

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management nrl tr T is init st o on or mor nos suh tht thr is on sint no r, ll th root o T, n th rminin nos r prtition into n isjoint susts T, T,, T n, h o whih is tr, n whos roots r, r,, r n, rsptivly, r hilrn o

More information

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths. How os it work? Pl vlu o imls rprsnt prts o whol numr or ojt # 0 000 Tns o thousns # 000 # 00 Thousns Hunrs Tns Ons # 0 Diml point st iml pl: ' 0 # 0 on tnth n iml pl: ' 0 # 00 on hunrth r iml pl: ' 0

More information

Similarity Search. The Binary Branch Distance. Nikolaus Augsten.

Similarity Search. The Binary Branch Distance. Nikolaus Augsten. Similrity Srh Th Binry Brnh Distn Nikolus Augstn nikolus.ugstn@sg..t Dpt. of Computr Sins Univrsity of Slzurg http://rsrh.uni-slzurg.t Vrsion Jnury 11, 2017 Wintrsmstr 2016/2017 Augstn (Univ. Slzurg) Similrity

More information

Page 1. Question 19.1b Electric Charge II Question 19.2a Conductors I. ConcepTest Clicker Questions Chapter 19. Physics, 4 th Edition James S.

Page 1. Question 19.1b Electric Charge II Question 19.2a Conductors I. ConcepTest Clicker Questions Chapter 19. Physics, 4 th Edition James S. ConTst Clikr ustions Chtr 19 Physis, 4 th Eition Jms S. Wlkr ustion 19.1 Two hrg blls r rlling h othr s thy hng from th iling. Wht n you sy bout thir hrgs? Eltri Chrg I on is ositiv, th othr is ngtiv both

More information

QUESTIONS BEGIN HERE!

QUESTIONS BEGIN HERE! Points miss: Stunt's Nm: Totl sor: /100 points Est Tnnss Stt Univrsity Dprtmnt of Computr n Informtion Sins CSCI 710 (Trnoff) Disrt Struturs TEST for Fll Smstr, 00 R this for strtin! This tst is los ook

More information

Using the Printable Sticker Function. Using the Edit Screen. Computer. Tablet. ScanNCutCanvas

Using the Printable Sticker Function. Using the Edit Screen. Computer. Tablet. ScanNCutCanvas SnNCutCnvs Using th Printl Stikr Funtion On-o--kin stikrs n sily rt y using your inkjt printr n th Dirt Cut untion o th SnNCut mhin. For inormtion on si oprtions o th SnNCutCnvs, rr to th Hlp. To viw th

More information

Solutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1

Solutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1 Solutions for HW Exris. () Us th rurrn rltion t(g) = t(g ) + t(g/) to ount th numr of spnning trs of v v v u u u Rmmr to kp multipl gs!! First rrw G so tht non of th gs ross: v u v Rursing on = (v, u ):

More information

NP-Completeness. CS3230 (Algorithm) Traveling Salesperson Problem. What s the Big Deal? Given a Problem. What s the Big Deal? What s the Big Deal?

NP-Completeness. CS3230 (Algorithm) Traveling Salesperson Problem. What s the Big Deal? Given a Problem. What s the Big Deal? What s the Big Deal? NP-Compltnss 1. Polynomil tim lgorithm 2. Polynomil tim rution 3.P vs NP 4.NP-ompltnss (som slis y P.T. Um Univrsity o Txs t Dlls r us) Trvling Slsprson Prolm Fin minimum lngth tour tht visits h ity on

More information

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology! Outlin Computr Sin 331, Spnnin, n Surphs Mik Joson Dprtmnt o Computr Sin Univrsity o Clry Ltur #30 1 Introution 2 3 Dinition 4 Spnnin 5 6 Mik Joson (Univrsity o Clry) Computr Sin 331 Ltur #30 1 / 20 Mik

More information

COMPLEXITY OF COUNTING PLANAR TILINGS BY TWO BARS

COMPLEXITY OF COUNTING PLANAR TILINGS BY TWO BARS OMPLXITY O OUNTING PLNR TILINGS Y TWO RS KYL MYR strt. W show tht th prolm o trmining th numr o wys o tiling plnr igur with horizontl n vrtil r is #P-omplt. W uil o o th rsults o uquir, Nivt, Rmil, n Roson

More information

1. Determine whether or not the following binary relations are equivalence relations. Be sure to justify your answers.

1. Determine whether or not the following binary relations are equivalence relations. Be sure to justify your answers. Mth 0 Exm - Prti Prolm Solutions. Dtrmin whthr or not th ollowing inry rltions r quivln rltions. B sur to justiy your nswrs. () {(0,0),(0,),(0,),(,),(,),(,),(,),(,0),(,),(,),(,0),(,),(.)} on th st A =

More information

Announcements. These are Graphs. This is not a Graph. Graph Definitions. Applications of Graphs. Graphs & Graph Algorithms

Announcements. These are Graphs. This is not a Graph. Graph Definitions. Applications of Graphs. Graphs & Graph Algorithms Grphs & Grph Algorithms Ltur CS Fll 5 Announmnts Upoming tlk h Mny Crrs o Computr Sintist Or how Computr Sin gr mpowrs you to o muh mor thn o Dn Huttnlohr, Prossor in th Dprtmnt o Computr Sin n Johnson

More information

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS C 24 - COMBINATIONAL BUILDING BLOCKS - INVST 3 DCODS AND NCODS FALL 23 AP FLZ To o "wll" on this invstition you must not only t th riht nswrs ut must lso o nt, omplt n onis writups tht mk ovious wht h

More information

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation A Simpl Co Gnrtor Co Gnrtion Chptr 8 II Gnrt o for singl si lok How to us rgistrs? In most mhin rhitturs, som or ll of th oprnsmust in rgistrs Rgistrs mk goo tmporris Hol vlus tht r omput in on si lok

More information

Garnir Polynomial and their Properties

Garnir Polynomial and their Properties Univrsity of Cliforni, Dvis Dprtmnt of Mthmtis Grnir Polynomil n thir Proprtis Author: Yu Wng Suprvisor: Prof. Gorsky Eugny My 8, 07 Grnir Polynomil n thir Proprtis Yu Wng mil: uywng@uvis.u. In this ppr,

More information

Chapter 9. Graphs. 9.1 Graphs

Chapter 9. Graphs. 9.1 Graphs Chptr 9 Grphs Grphs r vry gnrl lss of ojt, us to formliz wi vrity of prtil prolms in omputr sin. In this hptr, w ll s th sis of (finit) unirt grphs, inluing grph isomorphism, onntivity, n grph oloring.

More information

Chapter 18. Minimum Spanning Trees Minimum Spanning Trees. a d. a d. a d. f c

Chapter 18. Minimum Spanning Trees Minimum Spanning Trees. a d. a d. a d. f c Chptr 8 Minimum Spnning Trs In this hptr w ovr importnt grph prolm, Minimum Spnning Trs (MST). Th MST o n unirt, wight grph is tr tht spns th grph whil minimizing th totl wight o th gs in th tr. W irst

More information

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely . DETERMINANT.. Dtrminnt. Introution:I you think row vtor o mtrix s oorint o vtors in sp, thn th gomtri mning o th rnk o th mtrix is th imnsion o th prlllppi spnn y thm. But w r not only r out th imnsion,

More information

Register Allocation. Register Allocation. Principle Phases. Principle Phases. Example: Build. Spills 11/14/2012

Register Allocation. Register Allocation. Principle Phases. Principle Phases. Example: Build. Spills 11/14/2012 Rgistr Allotion W now r l to o rgistr llotion on our intrfrn grph. W wnt to l with two typs of onstrints: 1. Two vlus r liv t ovrlpping points (intrfrn grph) 2. A vlu must or must not in prtiulr rhitturl

More information

0.1. Exercise 1: the distances between four points in a graph

0.1. Exercise 1: the distances between four points in a graph Mth 707 Spring 2017 (Drij Grinrg): mitrm 3 pg 1 Mth 707 Spring 2017 (Drij Grinrg): mitrm 3 u: W, 3 My 2017, in lss or y mil (grinr@umn.u) or lss S th wsit or rlvnt mtril. Rsults provn in th nots, or in

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Rp: Grphs 80: Algorthm Dsgn n Anlyss Jrmh Blok Puru Unvrsty prng 09 Dfnton of Grph Rprsnttons Any Mtrx Any Lst onntvty, yls Trs (onnt + No yls) Root Trs/Bnry Trs/Bln Bnry Trs Brth Frst rh BF Tr O(m+n)

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Chptr 4 4. Intrvl hulng Gry Algorthms ls y Kvn Wyn. Copyrght 005 Prson-Ason Wsly. All rghts rsrv. Intrvl hulng Intrvl hulng: Gry Algorthms Intrvl shulng. Jo strts t s n fnshs t f. Two os omptl f thy on't

More information

CS553 Lecture Register Allocation I 3

CS553 Lecture Register Allocation I 3 Low-Lvl Issus Last ltur Intrproural analysis Toay Start low-lvl issus Rgistr alloation Latr Mor rgistr alloation Instrution shuling CS553 Ltur Rgistr Alloation I 2 Rgistr Alloation Prolm Assign an unoun

More information

XML and Databases. Outline. Recall: Top-Down Evaluation of Simple Paths. Recall: Top-Down Evaluation of Simple Paths. Sebastian Maneth NICTA and UNSW

XML and Databases. Outline. Recall: Top-Down Evaluation of Simple Paths. Recall: Top-Down Evaluation of Simple Paths. Sebastian Maneth NICTA and UNSW Smll Pth Quiz ML n Dtss Cn you giv n xprssion tht rturns th lst / irst ourrn o h istint pri lmnt? Ltur 8 Strming Evlution: how muh mmory o you n? Sstin Mnth NICTA n UNSW

More information

N=4 L=4. Our first non-linear data structure! A graph G consists of two sets G = {V, E} A set of V vertices, or nodes f

N=4 L=4. Our first non-linear data structure! A graph G consists of two sets G = {V, E} A set of V vertices, or nodes f lulu jwtt pnlton sin towr ounrs hpl lpp lu Our irst non-linr t strutur! rph G onsists o two sts G = {V, E} st o V vrtis, or nos st o E s, rltionships twn nos surph G onsists o sust o th vrtis n s o G jnt

More information

learning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms

learning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms rp loritms lrnin ojtivs loritms your sotwr systm sotwr rwr lrn wt rps r in mtmtil trms lrn ow to rprsnt rps in omputrs lrn out typil rp loritms wy rps? intuitivly, rp is orm y vrtis n s twn vrtis rps r

More information

(a) v 1. v a. v i. v s. (b)

(a) v 1. v a. v i. v s. (b) Outlin RETIMING Struturl optimiztion mthods. Gionni D Mihli Stnford Unirsity Rtiming. { Modling. { Rtiming for minimum dly. { Rtiming for minimum r. Synhronous Logi Ntwork Synhronous Logi Ntwork Synhronous

More information

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations Mr Funtins Grphs, Pruts, & Rltins Unirt Grphs An unirt grph is pir f 1. A st f ns 2. A st f gs (whr n g is st f tw ns*) Friy, Sptmr 2, 2011 Ring: Sipsr 0.2 ginning f 0.4; Stughtn 1.1.5 ({,,,,}, {{,}, {,},

More information

Computational Biology, Phylogenetic Trees. Consensus methods

Computational Biology, Phylogenetic Trees. Consensus methods Computtionl Biology, Phylognti Trs Consnsus mthos Asgr Bruun & Bo Simonsn Th 16th of Jnury 2008 Dprtmnt of Computr Sin Th univrsity of Copnhgn 0 Motivtion Givn olltion of Trs Τ = { T 0,..., T n } W wnt

More information

4. GREEDY ALGORITHMS I

4. GREEDY ALGORITHMS I 4. GREEDY ALGORITHMS I coin chnging intervl scheduling scheduling to minimize lteness optiml cching Lecture slides by Kevin Wyne Copyright 2005 Person-Addison Wesley http://www.cs.princeton.edu/~wyne/kleinberg-trdos

More information

DUET WITH DIAMONDS COLOR SHIFTING BRACELET By Leslie Rogalski

DUET WITH DIAMONDS COLOR SHIFTING BRACELET By Leslie Rogalski Dut with Dimons Brlt DUET WITH DIAMONDS COLOR SHIFTING BRACELET By Lsli Roglski Photo y Anrw Wirth Supruo DUETS TM from BSmith rt olor shifting fft tht mks your work tk on lif of its own s you mov! This

More information

10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms

10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms 0/0/ CS/ENGRD 0 Ojt- Orint Prormmin n Dt Strutur Fll 0 Dou Jm Ltur 9: DFS, BFS & Shortt Pth Toy Rhility Dpth-Firt Srh Brth-Firt Srh Shortt Pth Unwiht rph Wiht rph Dijktr lorithm Rhility Alorithm Dpth Firt

More information

MULTIPLE-LEVEL LOGIC OPTIMIZATION II

MULTIPLE-LEVEL LOGIC OPTIMIZATION II MUTIPE-EVE OGIC OPTIMIZATION II Booln mthos Eploit Booln proprtis Giovnni D Mihli Don t r onitions Stnfor Univrsit Minimition of th lol funtions Slowr lgorithms, ttr qulit rsults Etrnl on t r onitions

More information

Present state Next state Q + M N

Present state Next state Q + M N Qustion 1. An M-N lip-lop works s ollows: I MN=00, th nxt stt o th lip lop is 0. I MN=01, th nxt stt o th lip-lop is th sm s th prsnt stt I MN=10, th nxt stt o th lip-lop is th omplmnt o th prsnt stt I

More information

Aquauno Video 6 Plus Page 1

Aquauno Video 6 Plus Page 1 Connt th timr to th tp. Aquuno Vio 6 Plus Pg 1 Usr mnul 3 lik! For Aquuno Vio 6 (p/n): 8456 For Aquuno Vio 6 Plus (p/n): 8413 Opn th timr unit y prssing th two uttons on th sis, n fit 9V lklin ttry. Whn

More information

Seven-Segment Display Driver

Seven-Segment Display Driver 7-Smnt Disply Drivr, Ron s in 7-Smnt Disply Drivr, Ron s in Prolm 62. 00 0 0 00 0000 000 00 000 0 000 00 0 00 00 0 0 0 000 00 0 00 BCD Diits in inry Dsin Drivr Loi 4 inputs, 7 outputs 7 mps, h with 6 on

More information

Nefertiti. Echoes of. Regal components evoke visions of the past MULTIPLE STITCHES. designed by Helena Tang-Lim

Nefertiti. Echoes of. Regal components evoke visions of the past MULTIPLE STITCHES. designed by Helena Tang-Lim MULTIPLE STITCHES Nrtiti Ehos o Rgl omponnts vok visions o th pst sign y Hln Tng-Lim Us vrity o stiths to rt this rgl yt wrl sign. Prt sping llows squr s to mk roun omponnts tht rp utiully. FCT-SC-030617-07

More information

Strongly connected components. Finding strongly-connected components

Strongly connected components. Finding strongly-connected components Stronly onnt omponnts Fnn stronly-onnt omponnts Tylr Moor stronly onnt omponnt s t mxml sust o rp wt rt pt twn ny two vrts SE 3353, SMU, Dlls, TX Ltur 9 Som sls rt y or pt rom Dr. Kvn Wyn. For mor normton

More information

CSI35 Chapter 11 Review

CSI35 Chapter 11 Review 1. Which of th grphs r trs? c f c g f c x y f z p q r 1 1. Which of th grphs r trs? c f c g f c x y f z p q r . Answr th qustions out th following tr 1) Which vrtx is th root of c th tr? ) wht is th hight

More information

The Plan. Honey, I Shrunk the Data. Why Compress. Data Compression Concepts. Braille Example. Braille. x y xˆ

The Plan. Honey, I Shrunk the Data. Why Compress. Data Compression Concepts. Braille Example. Braille. x y xˆ h ln ony, hrunk th t ihr nr omputr in n nginring nivrsity of shington t omprssion onpts ossy t omprssion osslss t omprssion rfix os uffmn os th y 24 2 t omprssion onpts originl omprss o x y xˆ nor or omprss

More information

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued...

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued... Progrssiv Printing T.M. CPITLS g 4½+ Th sy, fun (n FR!) wy to tch cpitl lttrs. ook : C o - For Kinrgrtn or First Gr (not for pr-school). - Tchs tht cpitl lttrs mk th sm souns s th littl lttrs. - Tchs th

More information

ECE 407 Computer Aided Design for Electronic Systems. Circuit Modeling and Basic Graph Concepts/Algorithms. Instructor: Maria K. Michael.

ECE 407 Computer Aided Design for Electronic Systems. Circuit Modeling and Basic Graph Concepts/Algorithms. Instructor: Maria K. Michael. 0 Computr i Dsign or Eltroni Systms Ciruit Moling n si Grph Conptslgorithms Instrutor: Mri K. Mihl MKM - Ovrviw hviorl vs. Struturl mols Extrnl vs. Intrnl rprsnttions Funtionl moling t Logi lvl Struturl

More information

Multipoint Alternate Marking method for passive and hybrid performance monitoring

Multipoint Alternate Marking method for passive and hybrid performance monitoring Multipoint Altrnt Mrkin mtho or pssiv n hyri prormn monitorin rt-iool-ippm-multipoint-lt-mrk-00 Pru, Jul 2017, IETF 99 Giuspp Fiool (Tlom Itli) Muro Coilio (Tlom Itli) Amo Spio (Politnio i Torino) Riro

More information

CS September 2018

CS September 2018 Loil los Distriut Systms 06. Loil los Assin squn numrs to msss All ooprtin prosss n r on orr o vnts vs. physil los: rport tim o y Assum no ntrl tim sour Eh systm mintins its own lol lo No totl orrin o

More information

16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am

16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am 16.unii Introution to Computrs n Prormmin SOLUTIONS to Exmintion /30/0 9:05m - 10:00m Pro. I. Kristin Lunqvist Sprin 00 Grin Stion: Qustion 1 (5) Qustion (15) Qustion 3 (10) Qustion (35) Qustion 5 (10)

More information

Designing A Concrete Arch Bridge

Designing A Concrete Arch Bridge This is th mous Shwnh ri in Switzrln, sin y Rort Millrt in 1933. It spns 37.4 mtrs (122 t) n ws sin usin th sm rphil mths tht will monstrt in this lsson. To pro with this lsson, lik on th Nxt utton hr

More information

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata CSE303 - Introduction to th Thory of Computing Smpl Solutions for Exrciss on Finit Automt Exrcis 2.1.1 A dtrministic finit utomton M ccpts th mpty string (i.., L(M)) if nd only if its initil stt is finl

More information

Section 3: Antiderivatives of Formulas

Section 3: Antiderivatives of Formulas Chptr Th Intgrl Appli Clculus 96 Sction : Antirivtivs of Formuls Now w cn put th is of rs n ntirivtivs togthr to gt wy of vluting finit intgrls tht is ct n oftn sy. To vlut finit intgrl f(t) t, w cn fin

More information

CS553 Lecture Register Allocation 1

CS553 Lecture Register Allocation 1 Low-Lvl Issus Lst ltur Livnss nlysis Rgistr llotion Toy Mor rgistr llotion Wnsy Common suxprssion limintion or PA2 Logistis PA1 is u PA2 hs n post Mony th 15 th, no lss u to LCPC in Orgon CS553 Ltur Rgistr

More information

FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *

FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, * CmSc 365 Thory of Computtion Finit Stt Automt nd Rgulr Exprssions (Chptr 2, Sction 2.3) ALPHABET oprtions: U, conctntion, * otin otin Strings Form Rgulr xprssions dscri Closd undr U, conctntion nd * (if

More information

MAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017

MAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017 MAT3707/201/1/2017 Tutoril lttr 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS MAT3707 Smstr 1 Dprtmnt o Mtmtil Sins SOLUTIONS TO ASSIGNMENT 01 BARCODE Din tomorrow. univrsity o sout ri SOLUTIONS TO ASSIGNMENT

More information

Trees as operads. Lecture A formalism of trees

Trees as operads. Lecture A formalism of trees Ltur 2 rs s oprs In this ltur, w introu onvnint tgoris o trs tht will us or th inition o nroil sts. hs tgoris r gnrliztions o th simpliil tgory us to in simpliil sts. First w onsir th s o plnr trs n thn

More information

EE1000 Project 4 Digital Volt Meter

EE1000 Project 4 Digital Volt Meter Ovrviw EE1000 Projt 4 Diitl Volt Mtr In this projt, w mk vi tht n msur volts in th rn o 0 to 4 Volts with on iit o ury. Th input is n nlo volt n th output is sinl 7-smnt iit tht tlls us wht tht input s

More information

QUESTIONS BEGIN HERE!

QUESTIONS BEGIN HERE! Points miss: Stunt's Nm: Totl sor: /100 points Est Tnnss Stt Univrsity Dprtmnt o Computr n Inormtion Sins CSCI 2710 (Trno) Disrt Struturs TEST or Sprin Smstr, 2005 R this or strtin! This tst is los ook

More information

Improving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e)

Improving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e) POW CSE 36: Dt Struturs Top #10 T Dynm (Equvln) Duo: Unon-y-Sz & Pt Comprsson Wk!! Luk MDowll Summr Qurtr 003 M! ZING Wt s Goo Mz? Mz Construton lortm Gvn: ollton o rooms V Conntons twn t rooms (ntlly

More information