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

Size: px
Start display at page:

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

Transcription

1 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 giv us ni ynmi progrmming lgorithm. But thn, upon urthr insption, w noti tht ny optiml solution only pns on looking up th optiml solution to on othr suprolm. A gry lgorithm is n lgorithm whih xploits suh strutur, ignoring othr possil hois. Gry lgorithms n sn s rinmnt o ynmi progrmming; in orr to prov tht gry lgorithm is orrt, w must prov tht to omput n ntry in our tl, it is suiint to onsir t most on othr tl ntry; tht is, t h point in th lgorithm, w n mk gry, lolly-optiml hoi, n gurnt tht glolly-optiml solution still xists. Inst o onsiring multipl hois to solv suprolm, gry lgorithms only onsir singl suprolm, so thy run xtrmly quikly gnrlly, linr or los-to-linr in th prolm siz. Unortuntly, gry lgorithms o not lwys giv th optiml solution, ut thy rquntly giv goo (pproximt) solutions. To giv orrt gry lgorithm on must irst intiy optiml sustrutur (s in ynmi progrmming), n thn rgu tht t h stp, you only n to onsir on suprolm. Tht is, vn though thr my mny possil suprolms to rurs on, givn our sltion o suprolm, thr is lwys optiml solution tht ontins th optiml solution to th slt suprolm.. Ativity Sltion Prolm On prolm, whih hs vry ni (orrt) gry lgorithm, is th Ativity Sltion Prolm. In this prolm, w hv numr o tivitis. Your gol is to hoos sust o th tivis to prtiipt in. Eh tivity hs strt tim n n tim, n you n t prtiipt in multipl tivitis t on. Thus, givn n tivitis, 2,..., n whr i hs strt tim s i, inish tim i, w wnt to in mximum st o non-onliting tivitis. Th tivity sltion prolm hs mny pplitions, most notly in shuling jos to run on singl mhin... Optiml Sustrutur Lt s strt y onsiring sust o th tivitis. In prtiulr, w ll intrst in onsiring th st o tivitis S i,j th strt tr tivity i inishs n n or tivity j strts. Tht is, S i,j = { k i s k, k s j }. W n prtiipt in ths tivitis twn i n j. Lt A i,j mximum sust o non-onliting tivitis rom th sust S i,j. Suppos som k A i,j, thn w n rk own th optiml susolution A i,j s ollows A i,j = + A i,k + A k,j whr A i,k is th st st or S i,k (or k ), n A k,j is th st st or tr k. Anothr wy o intrprting this xprssion is to sy on w pl k in our optiml st, w n only onsir optiml solutions to suprolms tht o not onlit with k. Thus, w n immitly om up with rurrn tht llows us to om up with ynmi progrmming lgorithm to solv th prolm. A i,j = mx k S i,j + A i,k + A k,j

2 This prolm rquirs us to ill in tl o siz n 2, so th ynmi progrmming lgorithm will run in Ω(n 2 ) tim. Th tul runtim is O(n ) sin illing in singl ntry might tk O(n) tim. But w n o ttr! W will show tht w only n to onsir th k with th smllst inishing tim, whih immitly llows us to srh or th optiml tivity sltion in linr tim. Clim. For h S i,j, thr is n optiml solution A i,j ontining k S i,j o minimum inishing tim k. Not tht i th lim is tru, whn k is minimum, thn A i,k is mpty, s no tivitis n inish or k ; thus, our optiml solution only pns on on othr suprolm A k,j (giving us linr tim lgorithm). Hr, w prov th lim. Proo. Lt k th tivity o minimum inishing tim in S i,j. Lt A i,j som mximum st o nononliting tivitis. Consir A i,j = A i,j \ { l } { k } whr l is th tivity o minimum inishing tim in A i,j. It s lr tht A i,j = A i,j. W n to show tht A i,j os not hv onliting tivitis. W know l A i,j S i,j. This implis l k, sin k hs th min inishing tim in S i,j. All t A i,j \ { l } on t onlit with l, whih mns tht s t l, whih mns tht s t k, so this mns tht no tivity in A i,j \ { l } n onlit with k. Thus, A i,j is n optiml solution. Du to th ov lim, th xprssion or A i,j rom or simpliis to th ollowing xprssion in trms o k S i,j, th tivity with minimum inishing tim k. A i,j = + A k,j A i,j = A k,j { k } Algorithm Gry-AS ssums tht th tivitis r prsort in nonrsing orr o thir inishing tim, so tht i i < j, i j. Algorithm : Gry-AS() A { } // tivity o min i k or m = 2 n o i s m k thn // m strts tr lst itivity in A A A { m } k m rturn A By th ov lim, this lgorithm will prou lgl, optiml solution vi gry sltion o tivitis. Th lgorithm os singl pss ovr th tivitis, n thus only rquirs O(n) tim rmti improvmnt rom th trivil ynmi progrmming solution. I th lgorithm lso n to sort th tivitis y i, thn its runtim woul O(n log n) whih is still ttr thn th originl ynmi progrmming solution. 2 Minimum Spnning Trs Th minimum spnning tr prolm is strutur s ollows: Input: G = (V, E) unirt, w: E Z Output: A tr onnting ll o V with minimum totl wight Exmpl Blow is n xmpl o th minimum spnning tr o grph. In th xmpl, th gs orming th minimum spnning tr r olor lu whil gs tht r not prt o th minimum spnning tr r olor lk. 2

3 Fining Minimum Spnning Trs Algorithms or ining Minimum Spnning Trs tn to gry lgorithms. Ths lgorithms mintin n uil upon som sust o th gs o th grph A E with th invrint tht A is lwys sust o Minimum Spnning Tr. In h stp, gs will grily to A suh tht A will ontinu to sust o Minimum Spnning Tr. Whn th lgorithm trmints, A will ontin st o gs tht orm Minimum Spnning Tr o th grph. Th ut proprty o th MST prolm is in s ollows: Thorm.. Lt A E sust o som MST, lt S V sust suh tht thr is no g in A onnting S to V \S, n lt (u, v) th g in G with minimum wight suh tht u S, v S, thn A {(u, v)} is sust o som MST. Proo o ut proprty. Lt T som MST ontining A. Sin A hs no gs rom S to V \S ut T is spnning, T hs som g (x, y) with x S n y S. I (x, y) is rmov rom T, two sutrs r otin whih w n ll T x n T y. Without loss o gnrlity w ssum tht u T x n v T y. Aing (u, v) rsults in th tr T = T \{(x, y)} {(u, v)} whih is still spnning tr. wight(t ) = wight(t ) - wight((x, y)) + wight((u, v)). Sin wight((u, v)) wight((x, y)) w hv tht wight(t ) wight(t ) whih onsquntly mns tht T is n MST. Nxt, w will prsnt thr irnt lgorithms or ining n MST. Eh lgorithm will gry n orrtnss will ollow y mintining th ut proprty. As w v sn or, thr will tros twn running h lgorithm, so it s goo to unrstn how h o thm works.. Borůvk s Algorithm Borůvk s Algorithm only works or grphs with istint g wights. At high lvl, th st A mintin y th lgorithm n thought o s st o isjoint trs. In h stp, h tr in A piks th g with minimum wight ling out o it n mrgs with th tr t th othr npoint o this slt minimum g. This pross is rpt until only on tr rmins, whih is thn th rturn MST. Bor w lv urthr into th xt untionlity o Borůvk s Algorithm, w in two trms: suprnos n suprgs. A suprno is in to olltion no tht ontins multipl nos within it. A suprg (t, t ) xists twn suprnos t n t i x t, y t suh tht (x, y) E. I multipl suh gs xist, (x, y) is slt to th g with minimum wight tht onnts no in t n no in t. In Borůvk s Algorithm, vry no is irst initiliz to suprno n vry g is initiliz s suprg. In h stp o th lgorithm, h suprno t lots its minimum wight suprg (t, t ).

4 t is thn mrg togthr with t to rt nw suprno, n th rl-g orrsponing to th slt suprg (t, t ) is to th MST. Algorithm 2: Borůvk(G = (V, E)) T mpty st orh v V o Crt suprno t ontining v; T T {t} orh (u, v) E o Crt suprg (t, t ) whr u t n v t ; whil Mor thn on suprno in T o X mpty st orh t T o in min wight suprg (t, t ); X X {(t, t )}; orh (t, t ) X o //to optimiz runtim, itrt in DFS orr on X Mrg(t, t ); A A rl-g((t, t )) rturn A Exmpl In this xmpl w will go through th stps o pplying Borůvk s Algorithm in orr to in th MST o th ollowing grph: In th irst itrtion, w slt th minimum suprg o h suprno. Sin tr initiliztion vry no is suprno n vry g is suprg, this is quivlnt to slting th minimum wight g o h no. 4

5 Following th mrg oprtions th rmining suprnos r {,, } n {,, }. Th suprg twn ths suprnos is in y th rl-g (, ). Thus w g (, ) to th MST n ollowing nothr mrg oprtion w r lt with only on suprno t whih point th lgorithm trmints. Mrging two suprnos t n t n on y rting nw suprno t n giving it ll suprgs o t n t tht r not suprgs twn t n t. To sv on runtim, th mrg lgorithm low piks th smllr gr no t n s ll its gs to t without rting multipls. (In th ltur w in t o this.) Algorithm : Mrg(t, t ) orh suprg (t, x), x t o i (t, x) not suprg thn suprg (t, x); i (t, x) lry suprg thn wight(t, x) min{wight(t, x), wight(t, x)} Dlt t rom th grph n T Whil w ll s tht th othr lgorithms run str thn Borůvk s, not tht us h suprno is uilt up sprtly, this lgorithm is highly prlllizl proprty whih is vry sirl. This proprty mks Borůvk s lgorithm prtiulrly usul or nlyzing vry lrg ntworks, possily in istriut stting. 5

6 Corrtnss. Most o th orrtnss ollows rom th ut proprty: or ny suprno/tr in A, th ut proprty itts tht piking th minimum wight g out o th suprno is s to to A. Howvr, u to th prlllism o th Borůvk stps, w n to mk sur tht th suprnos rmin trs, i.. tht A os not ontin ny yls. W prov this low, n this omplts th orrtnss proo o th lgorithm. Clim 2. I th wights o th gs in grph r ll istint, th st o gs A slt y Borůvk s Algorithm will not ontin ny yls. Proo. Suppos Borůvk s Algorithm whn ppli to grph whos g wights r ll istint ns up slting gs tht orm yl o k suprnos on suprnos v, v 2,..., v k whr suprnos with onsutiv susripts r jnt to on nothr in th yl. This mns tht t som stp in Borůvk s Algorithm w will n up slting suprgs (v, v 2 ), (v 2, v ),..., (v k, v ). Sin th wight o h suprg is istint, thr must mximum wight suprg in this yl. Cll this mximum suprg (v i, v i+ ). Sin this is th lrgst wight suprg in th yl, w know tht suprg (v i+, v i+2 ) must hv smllr wight thn suprg (v i, v i+ ). Thus (v i+, v i+2 ) will th suprg slt y suprno v i+ uring this stp o Borůvk s Algorithm. Howvr, similr rgumnt n ppli to suprg (v i, v i ) whih must lso hv smllr wight thn (v i, v i+ ) n onsquntly will th suprg slt y Borůvk s Algorithm or suprno v i t this stp. But this ls to ontrition sin nithr o th npoints o (v i, v i+ ) will n up slting this suprg uring Borůvk s Algorithm. Thus thr nnot ny yls in th st o gs slt y Borůvk s Algorithm i th wights o ll th gs in th grph r istint. Runtim. Th runtim o th mrg lgorithm is: O(min{g(t )) whr t is th no mrg into nothr no t. In ltur w mntion tht w n run Borůvk s Algorithm so tht th suprgs out o h suprno r ss t most onstnt numr o tim in h itrtion, so tht h itrtion runs in O(m) tim. Hr w giv th tils on how to o this. Consir th st X o gs to mrg in prtiulr itrtion. W will o th mrgs o gs in X in suitl orr. First go through X n rt out o it grph in jny list rprsnttion. This n on in O(n + X ) tim whr n is th urrnt numr o suprnos. Now w n run DFS on th sugrph inu rom X. Whnvr suprg (t, t ) o X is trvrs y th DFS srh, w mrg t into t. Sin X is orst (s w prov ov), th DFS srh will not nountr ny kgs. Thus, ny suprno tht is n npoint o suprg in X will us s t t most on. Thus its suprgs will to no t t most on. To hk whthr pir (t, x) is tully suprg o t, w n stor th suprgs o suprno in two ormts: th jny list ormt ( list o th suprgs L t ) n th jny vtor ormt (n rry N t o lngth n, suh tht i (t, x) is suprg, N[t] = ). Now, whn t is mrg into t, or ny suprg (t, x) out o t, on irst hks i N t [x] =. I so, thn just th wight o (t, x) is moii. Othrwis, N t [x] is st to n (t, x) is to th n o L t. In ition, N x [t] is st to n (t, x) is to th n o L x. Whn x is ss ltr in th lgorithm, oth (t, x) n (t, x) will ss whn srhing or th minimum g wight. Thn, (t, x) will isr sin t is no longr tiv, n w n think o this oprtion on (t, x) s ing pi or lry y th ition o (t, x) to x. (W omitt ll ths tils in ltur to sv tim.) Thus h itrtion o th lgorithm n run in O(m) tim (whil lso pying or isring utur (t, x) suprgs out o intiv suprnos t ). Anothr wy to mk th mrg oprtion st is to us union-in t strutur (s Kruskl s lgorithm low). Now w rss th numr o itrtions. In h stp o Borůvk s Algorithm, th minimum siz suprno is mrg with nothr suprno. Th siz o th minimum siz suprno will thus t lst oul tr h stp. It strts t n ns t n. This mns tht th numr o itrtions in Borůvk s Algorithm is log(n) whih givs us th inl runtim o Borůvk s Algorithm: O(m log n).

7 .2 Prim s Algorithm At high lvl, th st A mintin y Prim s Algorithm is singl tr. In h stp, th g with minimum wight ling out o A n onnting to no tht hs not yt n onnt to A is slt n to A. On A onnts vry no in th grph, it is rturn s n MST o th grph. Prim s Algorithm is similr to Dijkstr s Algorithm in tht stimts o th istn to h no r mintin n upt s th lgorithm progrsss. V (A) is in to th vrtis tht gs in A r inint to. (v) v V is in to th minimum g wight rom no o V (A) to v. Algorithm 4: Prim(G = (V, E)) A mpty st F mpty Fioni hp orh v V o (v) ; π(v) NIL; put v in F with ky (v); pik s rom V ; (s) ; whil F is not mpty o u F.xtrtmin; A A {(π(u), u)}; orh (u, v) E o i (v) > wight(u, v) thn (v) wight(u, v); π(v) u; rturn A Prim s Algorithm is irt moiition o Dijkstr s Algorithm n hs runtim o O(m + n log n). Exmpl In this xmpl w will run through th stps o pplying Prim s Algorithm in orr to intiy n MST or th ollowing grph: Suppos w slt no to th sour no, s. W thn xtrt no rom th Fioni hp n st () =, () = n π() =, π() =.

8 ,,,,,, Sin () is now th smllst vlu in th Fioni hp, w visit no. Bus π() = w g (, ) to th st A. W thn upt th istn stimts n prnt ils o nos tht hv gs onnting to. Thus w st () =, () =, () =, n π() =, π() =, n π() =.,,,,,, No is xtrt nxt n w g (, ) to A. W thn st () = n π() =.

9 ,,,,,, No is xtrt nxt n w g (, ) to A. W thn st () = n π() =.,,,,,, No is xtrt nxt n w g (, ) to A. No nos r upt tr this stp.,,,,,,

10 Finlly no is xtrt n g (, ) is to A. Atr this stp th Fioni hp will mpty n Prim s Algorithm will rturn A.,,,,,,. Kruskl s Algorithm At high lvl, th st A mintin y Kruskl s Algorithm is st o isjoint trs similr in sns to Borůvk s Algorithm. Howvr, Kruskl s Algorithm irs rom Borůvk s Algorithm in its upt stp. During upt stp i, i th i-th smllst g onnts irnt trs, mrg th two trs onnt y this g. Th lgorithm progrsss until vntully only on tr rmins t whih point th st A rprsnts n MST o th grph. Kruskl s Algorithm utilizs th union-in t strutur in orr to hnl th mrging o th isjoint trs mintin y th lgorithm. Th union-in t strutur supports isjoint sts with th ollowing oprtions: mkst(x): rts nw st ontining x provi tht x ny othr sts in(x): rturns th nm o th st ontining x union(x, y): mrg th st ontining x n th st ontining y into on st Th lgorithm itsl n strutur s ollows: Algorithm 5: Kruskls(G = (V, E)) A mpty st; E sort gs y wight in non rsing orr; orh v V o mkst(v); orh (u, v) E o i in(u) in(v) thn A A {(u, v)}; union(u, v); rturn A; Th orrtnss irtly ollows rom th ut proprty. Th runtim o Kruskl s Algorithm is pnnt on two tors: th tim to sort th gs y wight n th runtim o th union-in t strutur oprtions. Whil Ω(m log n) tim is rquir i w us 0

11 omprison sorting, in mny ss, w my l to sort th gs in linr tim. (Rll, you show in th homwork tht CountingSort n us to sort th gs in O(m) tim i th wights r givn y intgrs oun y polynomil in m. Th orrsponing lgorithm is ll Rix Sort.) In this s, th runtim is oun y th runtim o th union-in oprtions n is givn y O(nT (mkst)+mt (in)+nt (union)). Th st known runtim or th union-in oprtions is mortiz O(α(n)) whr α(n) is th invrs Akrmnn untion. Intrstingly, th vlu o th invrs Akrmnn is or ll prtil purposs tiny: α(n) 4, n < # toms in th univrs n thus or ll prtil purposs th union-in oprtions run in onstnt tim. Thus, in mny sttings, th runtim o Kruskl s lgorithm is nrly linr in th numr o gs. Th tul inition o α(n) is α(n) = min{k A(k) n}, whr A(k) is th Akrmnn untion vlut t k. A(k) itsl is in vi mor gnrl Akrmnn untion, in prtiulr, A(k) = A k (2). A k (x) is in rursivly. A 0 (x) = + x, so tht A 0 (2) =. A (x) = 2x (A 0 itrt x tims), so tht A (2) = 4 A 2 (x) = 2 x x (A itrt x tims), so tht A 2 (2) =... A (x) 2 222, towr o x 2s (A 2 itrt x tims), so tht A (2) 2 A 4 (x) is t lst towr o x towrs o x 2s, n A 4 (2) is t lst towr o 4 twos! This numr is lrgr thn th totl numr o toms in th known univrs, n lso lrgr thn th numr o nnosons sin th Big Bng. (Thus, α(n) 4 or ll prtil purposs.) Exmpl In this xmpl w will run through th stps o pplying Kruskl s Algorithm in orr to intiy n MST or th ollowing grph: W gin y rting nw st or h no in th grph. W thn ing itrting ovr th gs in non rsing orr. Th irst g w xmin is (, ). This g onnts nos n whih r urrntly not prt o th sm st. W thus inlu this g in A n union th sts ontining n.

12 Th nxt g in our sort orr is g (, ). Sin n r not prt o th sm st w inlu this g in A n union th sts ontining n. Th nxt g in th sort orr is (, ). W union th sts ontining n n g (, ) to A. Th nxt g in th sort orr is (, ). W union th sts ontining n n g (, ) to A. 2

13 Th nxt g in th sort orr is (, ). W union th sts ontining n n g (, ) to A. At this point ll nos r ontin in th sm st n so no urthr gs r to A.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

, 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

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

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

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

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

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

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

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

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

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

(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

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

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

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

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

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

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

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

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

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

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

# 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

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

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

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

Graph Contraction and Connectivity

Graph Contraction and Connectivity Chptr 17 Grph Contrtion n Conntivity So r w hv mostly ovr thniqus or solving prolms on grphs tht wr vlop in th ontxt o squntil lgorithms. Som o thm r sy to prllliz whil othrs r not. For xmpl, w sw tht

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

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

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

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

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

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

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

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

Jonathan Turner Exam 2-10/28/03

Jonathan Turner Exam 2-10/28/03 CS Algorihm n Progrm Prolm Exm Soluion S Soluion Jonhn Turnr Exm //. ( poin) In h Fioni hp ruur, u wn vrx u n i prn v u ing u v i v h lry lo hil in i l m hil o om ohr vrx. Suppo w hng hi, o h ing u i prorm

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

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

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

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

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

Lecture 20: Minimum Spanning Trees (CLRS 23)

Lecture 20: Minimum Spanning Trees (CLRS 23) Ltur 0: Mnmum Spnnn Trs (CLRS 3) Jun, 00 Grps Lst tm w n (wt) rps (unrt/rt) n ntrou s rp voulry (vrtx,, r, pt, onnt omponnts,... ) W lso suss jny lst n jny mtrx rprsntton W wll us jny lst rprsntton unlss

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

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

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

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

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

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

Solutions to Homework 5

Solutions to Homework 5 Solutions to Homwork 5 Pro. Silvia Frnánz Disrt Mathmatis Math 53A, Fall 2008. [3.4 #] (a) Thr ar x olor hois or vrtx an x or ah o th othr thr vrtis. So th hromati polynomial is P (G, x) =x (x ) 3. ()

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

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

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

Outline. Binary Tree

Outline. Binary Tree Outlin Similrity Srh Th Binry Brnh Distn Nikolus Austn nikolus.ustn@s..t Dpt. o Computr Sins Univrsity o Slzur http://rsrh.uni-slzur.t 1 Binry Brnh Distn Binry Rprsnttion o Tr Binry Brnhs Lowr Boun or

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

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

S i m p l i f y i n g A l g e b r a SIMPLIFYING ALGEBRA.

S i m p l i f y i n g A l g e b r a SIMPLIFYING ALGEBRA. S i m p l i y i n g A l g r SIMPLIFYING ALGEBRA www.mthltis.o.nz Simpliying SIMPLIFYING Algr ALGEBRA Algr is mthmtis with mor thn just numrs. Numrs hv ix vlu, ut lgr introus vrils whos vlus n hng. Ths

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

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals Intgrtion Continud Intgrtion y Prts Solving Dinit Intgrls: Ar Undr Curv Impropr Intgrls Intgrtion y Prts Prticulrly usul whn you r trying to tk th intgrl o som unction tht is th product o n lgric prssion

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

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

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

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

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

Register Allocation. How to assign variables to finitely many registers? What to do when it can t be done? How to do so efficiently?

Register Allocation. How to assign variables to finitely many registers? What to do when it can t be done? How to do so efficiently? Rgistr Allotion Rgistr Allotion How to ssign vrils to initly mny rgistrs? Wht to o whn it n t on? How to o so iintly? Mony, Jun 3, 13 Mmory Wll Disprity twn CPU sp n mmory ss sp improvmnt Mony, Jun 3,

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

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

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

(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

CS 103 BFS Alorithm. Mark Redekopp

CS 103 BFS Alorithm. Mark Redekopp CS 3 BFS Aloritm Mrk Rkopp Brt-First Sr (BFS) HIGHLIGHTED ALGORITHM 3 Pt Plnnin W'v sn BFS in t ontxt o inin t sortst pt trou mz? S?? 4 Pt Plnnin W xplor t 4 niors s on irtion 3 3 3 S 3 3 3 3 3 F I you

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

Depth First Search. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong

Depth First Search. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong Dprtmnt o Computr Sn n Ennrn Cns Unvrsty o Hon Kon W v lry lrn rt rst sr (BFS). Toy, w wll suss ts sstr vrson : t pt rst sr (DFS) lortm. Our susson wll on n ous on rt rps, us t xtnson to unrt rps s strtorwr.

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

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

Weighted Graphs. Weighted graphs may be either directed or undirected.

Weighted Graphs. Weighted graphs may be either directed or undirected. 1 In mny ppltons, o rp s n ssot numrl vlu, ll wt. Usully, t wts r nonntv ntrs. Wt rps my tr rt or unrt. T wt o n s otn rrr to s t "ost" o t. In ppltons, t wt my msur o t lnt o rout, t pty o ln, t nry rqur

More information

Module 2 Motion Instructions

Module 2 Motion Instructions Moul 2 Motion Instrutions CAUTION: Bor you strt this xprimnt, unrstn tht you r xpt to ollow irtions EXPLICITLY! Tk your tim n r th irtions or h stp n or h prt o th xprimnt. You will rquir to ntr t in prtiulr

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

Round 7: Graphs (part I)

Round 7: Graphs (part I) Roun 7: Grphs (prt I) Tommi Junttil Alto Univrsity Shool o Sin Dprtmnt o Computr Sin CS-A40 Dt Struturs n Alorithms Autumn 207 Tommi Junttil (Alto Univrsity) Roun 7 CS-A40 / Autumn 207 / 55 Topis: Grphs

More information

14 Shortest Paths (November 8)

14 Shortest Paths (November 8) CS G Ltur : Shortt Pth Fll 5 Shortt Pth (Novmr ). Introution Givn wight irt grph G = (V, E, w) with two pil vrti, our n trgt t, w wnt to in th hortt irt pth rom to t. In othr wor, w wnt to in th pth p

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

RAM Model. I/O Model. Real Machine Example: Nehalem : Algorithms in the Real World 4/9/13

RAM Model. I/O Model. Real Machine Example: Nehalem : Algorithms in the Real World 4/9/13 4//3 RAM Mol 5-853: Algorithms in th Rl Worl Lolity I: Ch-wr lgorithms Introution Sorting List rnking B-trs Bur trs Stnr thortil mol or nlyzing lgorithms: Ininit mmory siz Uniorm ss ost Evlut n lgorithm

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

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