Applications: The problem has several applications, for example, to compute periods of maximum net expenses for a design department.

Size: px
Start display at page:

Download "Applications: The problem has several applications, for example, to compute periods of maximum net expenses for a design department."

Transcription

1 A Gntl Introution to Aloritms: Prt III Contnts o Prt I: 1. Mr: (to mr two sort lists into sinl sort list.). Bul Sort 3. Mr Sort: 4. T Bi-O, Bi-Θ, Bi-Ω nottions: symptoti ouns Contnts o Prt II: 5. Bsis o nlysis o omplxity 5.1. Itrtions 5.. Rurrns W in tis stion wit n xmpl tt sows wy it is importnt to sin oo loritms. Hvin stlis tis, w will mov on to stuy t most ommon tniqus us in vlopin loritms or vrious prolms. Ts inlu itrtion, rursion, ivi-n-onqur, ry, n ynmi prormmin. I will try to iv xmpls o tkn rom spts o M Sys Dsin, tou, s I si, ts r vry ommon vrywr. 6. Importn o loritms T Mximum ontiuous su-rry prolm. Tis prolm n mol s ollows: Givn n rry A = [1,, n], in t sum Sij = sum( A[i] + + A[j]) Fin: (i, j) su tt S(i, j) Applitions: T prolm s svrl pplitions, or xmpl, to omput prios o mximum nt xpnss or sin prtmnt. Sin A[i],,A[j] is su-rry o A, w ll tis t mximl su-rry (MS) prolm. Lt s try simpl, rut-or loritm or MS: Aloritm: MS-rut ( A) 1. S = Smx = = = 0;. or i = 1 to n {.1 or j = i to n {. S = lultsum( A, i, j);.3 i (S > Smx) { Smx = S; = i; = j; 3. rturn Smx,, ; Anlysis o MS-rut: stp 1: onstnt tim. stp : T two or loops xut n tims, n tim ty run stp.. stp.. lultsum tks worst s n units o tim to lult t sum o t su-rry A[i] A[j]. Tus, worst s tim or stp is Θ(n 3 ). stp 3. rturns t inxs n vlu o t mximl su-rry, in onstnt tim.

2 Now w try to it smrtr. Noti t work on y t lultsum untion tim tt t inx j is inrmnt. For xmpl, wn i=1, w n to omput, in squn, S(1, 1), tn S(1, ), tn S(1, 3) till S(1, n). But S(i, j) = S(i, j-1) + A[j]. Tror, w n moiy t loritm to r-us t prviously omput vlu o t sum in stp, to t ttr loritm. Aloritm: MS-rus ( A) 1. Smx = = = 0;. or i = 1 to n {.1 S = 0;. or j = i to n {.3 S = S + A[j];.4 i (S > Smx) { Smx = S; = i; = j; 3. rturn Smx,, ; Anlysis o MS-rus: Noti tt t stps.3 n.4 only rquir onstnt tim now. Ts r omput Θ(n ) tims, ivin totl omplxity o Θ(n ). Cn w o vn ttr? Lt us try ivi-n-onqur loritm. Now w will n to o som plnnin to st it up. T ivi stp is sy: rk t rry into two (rouly) qul lvs: L = A[1,,m ] n R = A[m+1,, n], wr m = (n+1)/. Tr r tr possiilitis: (i) Smx or A lis ntirly in L; (ii) Smx or A lis ntirly in R; n (iii) Smx is m up o two omponnts, pritl-sum-lt, PL = A[, m] n prtil-sum-rit, PR = A[m+1,, ]. Lt s ous on t tir possiility, in prtiulr ow to omput SL (or SR): Clrly tis n on in O(m) tim s ollows: untion inltsum( A, m) 1. PL = PLmx = 0;. or i = m to 1 {.1. PL = PL + A[i];.. i (PL Similrly untion inritsum n in, wi lso runs in O(m) tim. Exmpl: A = [ 1, -5,4,, -, 3, 6, -1,, -4,, -,, 6, 1, -3]; ( n = 16) L = [ 1, -5,4,, -, 3, 6, -1 ], R = [, -4,, -,, 6, 1, -3]; I mx-sum lis ntirly in L, w n in it s: 6+3 = (s t lmnts in r olor). I mx-sum lis ntirly in R, w n in it s: +6+1 = (s t lmnts in r olor).

3 I mx sum is m up rom sris spnnin ross L n R, tn: PL =, (s r portions) rom: [ 1, -5,4,, -, 3, 6, -1 ] PR = 5, (s r portions) rom [, -4,, -,, 6, 1, -3]; n t mximl sum o tis mi portion = PL + PR = 13. Tus t ist o ts tr is t rquir nswr, nmly Smx = 13. Now w r ry to writ our MS-_n_ loritm: Aloritm: MS-_n_( A, i, j) 1. m = (i+j)/ ;. i ( i == j) rturn A[i]; ls.1. LS = MS-_n_( A, 1, m);.. RS = MS-_n_( A, m+1, n);.3. MS = inltsum( A, m) + inritsum( A, m); 3. rturn mx( LS, RS, MS). Anlysis o MS-_n_: Lt T(n) not t tim rquir to run MS-_n_ on input o siz n; Stp 1: onstnt tim; Stps.1 n.. rquir T(n/) Stp.3 rquirs O(n) tim, s isuss ov. Stp 3. onstnt tim. Tror w n writ: T(n) = T(n/) + O(n), n so (s t nots on rurrns) tt T(n) = O(n l n). So w s tt wit just littl tout, w v mn to ru rut or O(n 3 ) loritm to simpl O(n l n) on. Wit som intllint insits, w n somtims o ttr still, s w sll s in inl ttmpt to solv tis prolm. Din T(i) = A[1] + + A[i]. Tn: S(i, j) = T(j) T( i-1) [Wy?] Consir S(i, j): or ix j, S(i, j) will mximum wn T(i-1) is minimum. Tis ivs us int or linr tim loritm tt mrs ross t rry, n kps uptin t st urrnt solution till it rs t n. Lt us look t t ort involv in t i-t stp o tis loritm: Prprtion: w n omput n stor, in O(n) ll lmnts T[i] o t rry T. (i) At t n o itrtion (i-1), w know Smx(i-1) n Tmin(i-1). (ii) T[i] = T[i-1] + A[j]; (iii) MS(i) = T[i] Tmin(i-1) (iv) i T[i] < Tmin(i-1), tn upt Tmin = T[i] (v) I Smx < MS(i), tn upt t Smx = MS(i); E o ts stps tks onstnt tim, n tror t totr ty tk onstnt tim. Tror t ovrll loritm runs in O(n) tim! Hr is t psuo-o:

4 Aloritm: MS-linr( A) 1. T = A[1]; Smx = A[1]; Tmin = min( 0, T);. or i = to n {.1. T = T + A[j]; i ( (T Tmin) > Smx) Smx = (T Tmin); i (T < Tmin) Tmin = T 3. rturn Smx; Tis xmpl monstrts utiully wy it is ssntil to put mor tout in t sin o loritms. Rll tt vn n rom O(n ) to O(n l n) mks trmnous irn in t siz o input w n nl. T ov xmpl is mu mor rmti. Not: Tis prolm is ll t mximl su-rry prolm, n oo rrn to it is Jon Bntly s ook, Prormmin Prls.]. Grps Up till now, w v mn to stuy prolms wr t t ws in stor itr s list, or in rrys. In som ss, ts r not t st wy to stor inormtion out t prolm w r solvin. T most powrul tools, spilly or ll omintoril prolms (wi inlus mny M Sys Dsin prolms), r Grps. Grps r strt ojts, wi v n stui xtnsivly y mtmtiins, n mny o wos proprtis r wll unrstoo. As onsqun, i you n mol your prolm s prtiulr typ o rp, you n us proprtis known out su rps to lp you solv t prolm it str tn usul. Sin vry ours in rp tory ins wit t story o Eulr n t Konisur prolm, r is link. Tis stion is orniz s ollows: (i) rp trminoloy (ii) si rp t struturs (iii) xmpls o M Sys Ds prolms n ow to mol tm s rp prolms..1. Grp trminoloy A rp is in y two sts: st V o vrtis, n st E o s. E vrtx is rprsnt y nm,.. v 1,, v n. E is rprsnt y pir, (v, v ), wr v, v V. W sll not V s t numr o vrtis in t rp; E s t numr o s in t rp. Somtims, w will ssoit irtion wit. In tis s, (v, v ) rprsnts n oin rom v (ll t til) to v (ll t ). I ll s r irt, w ll t rp Dirt rp, or Dirp. Otrwis, ll s will ssum to unirt, n w will ll tis n unirt rp, or just rp.

5 Unlss spiilly mntion, w will ssum tt tr is no sl-loopin: s o t orm (, ) r not llow. W will lso ssum no prlll s (tt is, w nnot v two istint s (, ), n (, )). A wit rp (or wit irp) is rp wit numr ssoit wit. Most mnuturin pplitions us tis rprsnttion. i (i) Grp (ii) Dirp (iii) Wit Dirp Som xmpls: Filitis lyout: Fility is no, t wit o sows t ost o trnsportin mtrils twn t two ilitis tt rprsnt its n vrtis. Trnsporttion: E lotion is vrtx; wit o n is t istn twn t two lotions rprsnt y its vrtis. Mtril Hnlin: E vrtx is sour (ur, or wrous); wit o sows t pity o t MH systm joinin t two sours rprsnt y its vrtis. An is si to inint on t vrtis tt r t its ns. In irp, w sy t is inint rom t til, n inint to t. In irp, vrtx u is jnt to vrtx v i tr is n rom v to u in E. In rp, u n v r jnt i (u, v) E. Dr o vrtx v = numr o s inint on v. Dr o t rp = sum o t r o ll vrtis in t rp. Tus r(g) = E. In irp: outr = numr o s inint rom it, inr = numr o s inint to it; r = outr + inr. For irp, Σ(outr) = Σ ( inr) = E. A pt is squn o vrtis <v 1, v,, v k > su tt (v i, v i+1 ) E or ll i = 1,,k-1. T lnt o t pt = k-1 = numr o s in t pt. A pt is simpl i it s no loops, tt is, i ll vrtis r istint. A vrtx w is rl rom vrtx v i tr is pt rom v to w. A yl is pt o t orm <v 1, v,, v k, v 1 >, tt is, t irst n lst vrtis r intil. A yl is simpl i v 1, v,, v k r ll istint. Spil typs o rps: A onnt rp is on in wi vry pir o vrtis s pt onntin tm. A stronly onnt irp is on in wi vry vrtx is rl rom vry otr vrtx.

6 A rp wit no yls is ll yli. A irt yli rp is not s DAG. A orst is n yli, unirt rp. A tr is n unirt, yli, onnt rp. (i) Unonnt rp (ii) Connt rp (iii) Stronly Connt Dirp (iv) Wit DAG (v) Forst (vi) Tr Trs r oun vrywr, so it is usul to mmoriz t ollowin proprtis o trs; I G is rp, t ollowin sttmnts r quivlnt: (i) G is tr; (ii) Any two vrtis in G r onnt y uniqu, simpl pt. (iii) G is onnt, n E = V - 1 (iv) G is yli, n E = V Grp t struturs T two most ommon wys o rprsntin rps r (i) usin mtris, n (ii) usin lists link wit pointrs. Oviously, t son mto is mor suit or prormmin lnus tt provi irt support or pointr oprtions...1. Grp t struturs: Ajny Mtris Dirps: Lt G = ( { v 1, v,, v n, E ) irp. Tn w n us nxn mtrix A to rprsnt it s ollows: A[u][v] = w uv i (u,v) E; A[u][v] = 0 i t rp is unwit, n i it is wit. Hr, w uv is t wit o (u,v) i t rp is wit, otrwis it is 1. T mtrix A or irp my or my not symmtri. Unirt rps: Lt G = ( { v 1, v,, v n, E ) rp. W us nxn mtrix A to rprsnt it s ollows:

7 A[u][v] = A[u][v] = w uv i (u,v) E; A[u][v] = 0 i t rp is unwit, n i it is wit. Clrly, A is symmtri i t rp is unirt. Noti tt i t rp is unwit, tn w n just us 1/0 to not wtr two vrtis r onnt or not. Howvr, i t rp is wit, w nnot us 0 to not unonnt vrtis (sin it my onus wit n o zro wit). Hn w must us spil rtr (usully vry lr numr) to not tis. Tis my lso pn on t pplition: in trvlin slsmn prolm, two nos (itis) r isonnt => t istn twn tm is, wil in ntwork low prolm, wit o 0 nots zro pity, or isonnt vrtis).... Grp t struturs: Ajny lists An jny list is n rry A o n pointrs. Elmnt A[i] points to link list o vrtis {v k, su tt (v i, v k ) E. T two t struturs rquir irnt mount o stor, n lso v n t on t iiny o t loritm usin tm. Tror, pnin on wt you wnt to o, you v to i wi strutur is ttr or your prolm. Hr is simpl omprison: Oprtion Ajny Mtrix Ajny List Initiliztion/Sp Θ( V ) Θ( V + E ) Sn ll s on Θ( V ) Θ( V + E ) Ck i (u, v) E Θ (1) Θ( V ) Noti tt i t rp is vry nsly onnt (lmost ll vrtis onnt to lmost ll otrs), tn E. So or ns rps, t mtrix my ttr, wil or sprs rps wit only w s, t jny list is proly ttr..3. Grp pplitions in Mnuturin Systms Dsin Exmpl 1. You work in t oi o lr mnuturin ompny. T uilin s ois spr ovr two loors, n you n to onnt ommunition twn t onrn room on Floor wit t rption room on Floor 1. T wirs must o trou t ntwork o onuits tt is uilt wit t uilin. Wt is t lnt o wir you must purs? A typil pttrn o onuits my look lik t ollowin:

8 Floor Floor 1 Conrn room outlt Rption outlt Tis typ o prolm is vry ommon in mny pplitions o sin. It oms up in iruit sin, pt sin or AGV on sop loor, t. Anotr xmpl is in ilitis lyout sin: suppos tt w v omplt t sin o t lyout s purly on t siz o t prtmnts. Nxt, w n to sin t isls, or psss. T siz o t psswy twn two prtmnts pns on t mtril low volum. T isl n sin lon ny o t ounris o t prtmnts. Su prolm n otn mol s t ollowin: Givn rp G, n two nos, s n v, in t sortst pt twn t two nos. T rp n irt, unirt, or vn mix. Exmpl. A minry ompny s svrl prtmnts. Mtrils r osionlly trnsport in stl-ox twn prtmnts n t ompny is onsirin instllin n ovr ril-rn. Tr is no rstrition on t sp o t rils; t rnin points, it is possil to mov t stl-ox to spii rn. T min ost in t projt is t ost o t ovr rils, wi r proportionl to t totl lnt o t ril systm. How n w trmin t sp o t optimum ril-lins tt minimiz t ost, ut llow us to trnsport mtrils twn ny two spii prtmnts? For xmpl, in t iurs low, i t r ots not possil juntion points, n t lins not t rils, tn is option () ttr or ()? How o w know wi option is t st mon ll possiilitis? () () Not: Tis prolm, s stt, is irt pplition o prolm ll t Minimum Spnnin Tr (MST) o rp. T MST prolm s vrious pplitions, spilly in t sin o iruits (.. in PCB iruit, tr r n trminls tt must roun y in onnt totr; ow to join tm ll iintly?), sin o omputr n ommunition ntworks, t.

9 Exmpl 3. Filitis sin. W know t mount o mtril low twn pir o prtmnts in ility. E unit o mtril low rquirs us to llot som isl pity (.. xprss in t o isl wit). For prtmnt, t mtril inlow/outlow point is ivn, n t isls n run lon ny ounry sprtin two prtmnts. I tr is n isl lon n, w must py ix stup ost, plus vril ost proportionl to t wit. Dsin t isls (i.. wi s will us to orm isls, n t isl wit). Tis is vrsion o t ntwork pity plnnin prolm. Tis prolm n otr ntwork low prolms r ommonly stui in trnsporttion mols. Ts v mny pplitions rnin rom sin o ros, sin o piplins, wtr-supply, sw systms, n so on. W sll inor tis topi r, ut you will stuy it in your trministi OR (or ntwork low mols) ours.. Most Importnt Prims W soul know ts iv si tniqus: itrtions, rursions, ivi-n-onqur, ry, n DP. W v lry sn xmpls o t irst tr. Now w ous on Gry n on DP..1. Gry T ry uristi is on tniqu tt solvs som sminly omplx prolms in rmrkly iint wy. I will iv tr xmpls r, two wr it works rt, n tir wr it ils Dijkstr s sortst pt Dijkstr s loritm uss ry ppro to in sortst pts on rps in O( V ). Not tt Dijkstr s loritm only works wn ll wits. Tr r wys to implmnt it tt r mor iint, ut you n in out out tos yoursl. Givn wit, irt rp G = ( V, E), n two vrtis s, v V, in t sortst pt rom s to v (wr sortst is msur y t sum o t wits o t s in t pt). W will omit t proo o orrtnss, n lso t nlysis prts (you n rr tm rom [CLR]). I will iv ri sription, t psuo-o, n n xmpl. Dsription: Essntilly, t loritm uss two si is: ry sltion, n rlxtion. Rlxtion: At stp o t loritm, w ssoit wit no v numr, [v], wi is t uppr oun on t sortst pt istn o no v rom t sour s. For xmpl, in t innin, [s] = 0, n [v] = or ll v. Now ssum tt tr is n, (s, u), wit ost. Tn [u] n rs rom to. Tis is us o t ollowin: w n r rom s to u in two wys:

10 (i) irtly; s u in wi s it will ost us units to trvrs tis. (ii) vi otr routs o t orm: s v k v r u. In tis s, itr t totl ost o t s on ts routs is lss tn (sy t sum o wits o ts s is 6), tn rtinly w n r rom s to u wit ost 6 < ; on t otr n, i t totl wits o ts s up to, sy 14; tn rtinly w oul just o irtly rom s u wit wit. Tis i n xtn to ny vrtx v: Assum tr is n (u, v) E, wit wit w(u, v). Assum [u] n [v] r t urrntly known uppr ouns on u n v rsptivly. Tn w n rlx t uppr oun on v s ollows: i [v] > [u] + w( u, v), tn st [v] = [u] + w( u, v); otrwis, it is unn. Wn w o rlxtion, w lso will kp trk o t tt us rs in t uppr oun or v; tis is t prssor o v in t (urrnt) sortst known pt rom s to v, n w not it s π[v]. Gry sltion: Tis will om lr s w sri t loritm, low. W strt wit two lists: V = st o ll vrtis S = st o vrtis, u i, or wi [u i ] = inl sortst pt istn rom s to u i = δ(s, u i ) Initilly, S is mpty. At ny st, onsir ll t vrtis u i, or wi t sortst istn rom s s not yt n trmin, n pik t on wit t lst [u i ]. For tis vrtx, [u i ] = δ(s, u i ) [you soul try to prov tis: it is t rson tt ry strty works or Dijkstr!]. W rlx tis (rily slt) vrtx, n it to S. W rpt ts two stps o ry sltion n rlxtion until t ol vrtx, v, is to S. Tn w r on!. Aloritm: Dijkstr s sortst pt( G, s, v) 1. For vrtx v i V, [v i ] = ;. [s] = 0; 3. S = {; Q = V[G]; 4. rpt { 4.1. u = in_minimum_wit_vrtx( Q) 4.. rmov u rom Q, n u to S; 4.3. or vrtx v i in Aj[u] { i ( [v i ] > [u] + w( u, v) ) { [v i ] = [u] + w( u, v); π[v i ] = u; until (u == v); 5. rturn [v], sortst-pt( v, u); Nots: T stps 4.3, 4.3.1, 4.3., n r t rlxtion stps; T stp 4.1 is t ry sltion stp.

11 Stps 1 n 5 tk O( V ) tim. Stp 4.1. tks O( V ) tim, n in t worst s, it will xut O( V ) tims; so t totl omplxity is O( V ) Stps 4.3.x: Not tt vrtx, u, is insrt into S xtly on, so ts rlxtion stps xmin oin out o vrtx u xtly on. For, tr is onstnt ort in t rlxtion stps. Hn totl ort u to rlxtion is O(E). Tror, totl loritm omplxity is O( V + E ) = O( V ) [sin E = O( V )]. Exmpl: [sour: CLR] s 5 u 3 x 1 v 4 6 y G = (V, E) Ajny list t strutur: [ [ [s]->[u,1]->[x,5]] [ [u]->[x,]->[v,1]] [ [x]->[u,3]->[y,]->[v,]] [ [y]->[s,]->[v,6]] [ [v]->[y,4]] ] s 0 u 3 1 v 4 6 Stp 1. or vrtx v i, [v i ] = ; [s] = 0; 5 x y s 0 u 3 1 v 4 6 S = {s; V-S = {u, x, y, v rlx(s): [u] = ; [x] = 5; 5 x 5 y

12 s 0 5 u 3 x 5 1 v y S = {s; V-S = { u, x, y, v minimum-ost( V-S) = x; S = { s, x; V-S = { u, v, y rlx(x): [u] = ; [y] = ; [v] = 14; s 0 5 u 3 x 5 1 v y S = {s, x; V-S = { u, y, v minimum-ost( V-S) = y; S = { s, x, y; V-S = { u, v rlx(y): [s] = 0; // no n [v] = 13; s 0 5 u 3 x 5 1 v 4 6 y S = { s, x, y; V-S = { u, v minimum-ost( V-S) = u; S = { s, x, y, u; V-S = { v rlx(u): [x] = 5; // no n [v] = ; // T loritm trmints in // t nxt itrtion..1.. Minimum Spnnin Tr Anotr prolm or wi ry works is inin t minimum spnnin tr o rp. Tis prolm, ll MST, s pplitions in optimiztion o ommunition/omputr ntworks onntin svrl prtmnts or nos, livry routin pts twn prtmnts, t. Anotr pplition is in ormin t lst lnt wir to onnt ll t roun trminls on omplx PCB iruit or. Finlly, t MST s som tortil importn s tool to provi uppr ouns on optiml solutions to tour prolm: TSP (s nxt stion). W r ivn n unirt, wit, (onnt) rp G = (V, E), n n to in surp MST G = (V, E ), su tt: V = V (tis mns tt t su-rp spns G, i.. vrtx is rl rom vry otr. E E Sum o t wits o E is minimiz. T ov inition is tt o minimum spnnin su-rp. Howvr, s lon s ll wits r positiv, tis su-rp must tr, sin otrwis, tr is yl, n w n ru t totl wit y uttin wy t most xpnsiv on tis yl.

13 T iur low sows n xmpl o rp, wit t s o n MST mrk in r olor i Grp G MST mrk in r Not: MST is not uniqu.. rpl (, ) wit (, ) Dsription: T si i o t solution w us is s ollows: W strt wit n mpty st o vrtis, S, n in stp, w will on vrtx, v i, to it rom V-S. Imin tt t s r m o rur-ns, n st S, V-S s ounry lin rwn roun it. Consir wt ppns to onnt to v i wn w sit it into S. Eitr (i) tis will now ross ross t ounry o S, or (ii) it ws rlir rossin t ounry o S, n will now ompltly insi t ounry o S. At ny st, w slt t pst (tt s ry sltion) tt os ross rom S to V-S, n pull t vrtx onnt to it rom V-S into S. T proo o orrtnss o tis ppro is omitt [rr to CLR]. T prtiulr implmnttion o t MST loritm ivn r is ll Prim s loritm. W ssum tt t root o t tr, no r, is n input. Aloritm: MST-Prim( G, r) 0. V = st o vrtis o G; 1. or vrtx v V {ky[v] = ;. ky[r] = 0; π[r] = nil; 3. wil V 3.1. u = xtrt-minimum( V); 3.. or v Aj[u] { i v V n w(u, v) < ky[v] { π[v] = u; ky[v] = w(u, v); In t ov, ky[u] is t priority vlu ssin to t no u. Look t t wy tis vlu is st (in stp 3..1): or no tt is rmov rom t st V (n to t tr rown low t root, r), lin rom it to sussor is now potntil rossin ovr twn t st o unssin nos to t st o nos in t tr. T wit o t is ssin s t ky vlu o t nos on wi t is inint (unlss tr ws n rlir lry lin to tt vrtx rom prviously ssin no, wit lowr ost).

14 Anlysis: I will skip t nlysis, us it rquirs som kroun on t us o spil t struturs tt llow us to iintly prorm t xtrt-min(v) in O( l V) tim. Givn tt, sin t min ort is in t stp 3. tt loop is xut O( E ) tims. Omittin tils o t nlysis, w will just stt tt t loritm runs in O( E l V) tim. Exmpl: T ollowin xmpl uss t rp us rlir or t illustrtion o MST, sowin t stps o Prim s loritm i () Grp G MST-Prim( G, ) R-s: s o MST Es rossin t rn loop r nits or nxt stp i () i () i () i () i i () ()

15 i () i (i).1.3. Trvlin Slsmn Prolm Tis is proly on o t most wily stui prolms. T prolm n stt s ollows: Givn st o n nos (or itis), wit t wit o t twn ny pir o itis = t istn twn tm. Givn om, or strt no. Fin t minimum lnt yl tt strts orm t om no, visits no xtly on, n inlly rturns to t strt no. No known ry loritm is known to solv t TSP. Lt s try trivil mto: strt t om, n t stp, pik t nrst nior o t lst no visit. Tis ppro os not work; or instn, in t xmpl low t nrst nior (ry) uristi ivs t TSP tour mrk in lu olor, wi is lrly lonr tn t tour mrk in r. H Tr is trmnous mount o rsr rlt to solvin TSP. You n sily in, usin w-sr, w-ps tt list ll usul rrns to it. T st-known mtos to solv it us som uristi, n tniqus su s lol optimiztion (.. -opt, 3-opt, or k-opt), simult nnlin, nti loritms t v ll n tri. Sour o or svrl su ttmpts is vill on t w. Anotr wll stui vrition o t TSP is ll t Asymmtri TSP, in wi t istn twn nos is not symmtri, i.. (i, j) in nrl. Som trms rlt to t TSP: Eulr tour: An Eulr tour o rp is tour tt trvrss vry xtly on (ut my ross no on or mor tims). Not ll rps v n Eulr tour (s t nots on t Konisur puzzl). I n Eulr tour xists, it n oun quit iintly, in O( E ) tim!

16 Hmiltonin Cyl: Givn rp G = (V, E), Hmiltonin yl is simpl yl tt visits vrtx in V. Tis is t sis o som ilrn s ms. T iur low sows mous xmpl. Not ll rps ontin Hmiltonin yl (HC). A rp tt ontins t lst on HC is ll miltonin; otrwis, it is ll nonmiltonin. T r s pit n HC on t rp pitin oron T iur low sows iprtit rp (iprtit: rp wos vrtis n prtition into two non-ovrlppin sts o vrtis, su tt no vrtx witin prtition srs n ). I n unirt, iprtit rp s o numr o vrtis, it s no HC s [prov it!]. (An unirt i-prtit rp: no HC xists or su rps. HC s ol n importnt position in t tory o NP-ompltnss. Givn rp, tr is no known polynomil tim loritm, to isovr i it is Hmiltonin (mtmtiins v work on tis prolm or my 0 yrs). At tis point, w onlu t stion on t isussion o t Gry prim. T min points r tt wn Gry works (i.. ry strty n us to onvr to optimlity), it yils vry iint loritms, ut otn it ils. W sw two xmpls wr it work: Prim s MST n Dijkstr s sortst pt loritm. W sw two xmpls wr it os not urnt optimlity: TSP, n rlir, t COVERT sulin poliy... Dynmi Prormmin Dynmi prormmin, or DP, is n xtrmly importnt tool in inin optiml solutions to mny typs o prolms. By workin wit w xmpls, you soul try to t oo insit into wn you n us DP to solv prolm, n ow to st up t DP. Bkroun: Rll tt w wr l to solv som prolms iintly y t us o ivi-n-onqur (in prtiulr, t prolm o sortin list o numrs usin Mrsort). DP prolms v similr rtristi in, w sll us tis i o somow

17 omputin t solution to t i prolm y ominin solutions o proprly onstrut su-prolms. Howvr, tr is on ky irn twn ivi-n-onqur o Mrsort n DP: in t ormr s, o t su-prolms s solutly no rltion to ny o t otr suprolms, n su-prolm must solv iniviully. Howvr, prolm tt quliy or us o DP v t rtristi tt t solution o mny o t su-prolms v, rursivly, ommon su-prolms. In solvin or t min prolm, tim w v solv su-prolm, w will tror stor its solution, n t nxt tim w nountr t sm su-prolm, w just look-up t prviously omput vlu, try svin som ort. Bor oin into n xmpl, it is oo to rmmr wt typ o prolms DP is ppli to: it is us mostly in solvin optimiztion prolms (prolms wr som ojtiv untion vlu must mximiz; ontrst tis,.., to t prolm o sortin st o numrs). In prtiulr, it is us on isrt optimiztion prolms, wr w r srin or solution ovr rp tt rows xponntilly wit t prolm siz. In summry, som ky rtristis o DP: () DP is ppli most ommonly to optimiztion prolms () T prolm must xiit optiml su-strutur. In otr wors, t optiml solution to prolm ontins (s its susts) optiml solutions to su-prolms. () T min prolm is solv y solvin su-prolms (similr to t ivi stp o ivin-onqur), n mny su-prolms ontin t sm su-prolms witin tm. Tis proprty is ll t ovrlppin su-prolm proprty. Exmin t prolm you r solvin to s i you n intiy l tr o ts proprtis. I ys, tr is oo n you n us DP to solv it. In orr to pply DP, you n to o t ollowin: (1) Crtriz t strutur o n optiml solution () Rursivly in t vlu o n optiml solution (3) Comput t vlu o n optiml solution, strtin rom solvin t smllst suprolms, n workin upwrs. Tis is ll ottom-up omputtion. (4) I t omplt solution orrsponin to t optiml vlu is rquir, onstrut t optiml solution rom t omput inormtion. Not tt in stp 3, you only omput t optiml vlu o t ojtiv untion; in stp 4, you will nrt t vlus o t iniviul vrils tt mk up t optiml solution. Exmpl: T mnr o your ompny llot ut, W, wit wi you must uy on or mor mins. Tr r n irnt typs o mins in t mrkt, n min s rtin ost; w not t ost o min o typ i s w i. E min will nrt som nit vlu, not s v i. Your ojtiv is to uy tos mins tt will totlly mximiz your nit, wil not spnin mor tn your ut. W n mol tis s n optimiztion prolm: Lt xi = 1, i min i is purs, n 0 i it is not purs. W n to: mximiz Σ x i v i

18 su tt Σ 1,,n w i x i W x i { 0, 1, or ll i. Tis is n intr prorm, n tror not sy to solv or lr prolms. Lt us xplor t possiility o solvin it usin DP. Crtinly proprty () is tru: it is n optimiztion prolm. Bor w pply DP, w xmin potntil mto to solv tis prolm y numrtion: W onstrut two imnsionl rry: V[0..n][0..W] to stor som potntil solutions vlus. For 1 i n, n 0 w W, t lmnt V[i][w] stors t mximum vlu mon ny sust o mins { 1,,, i tt n purs wit ut = w. For onvnin, w will lso us nottion tt V[i, w] = - i w < 0; tis urnts tt ny oniurtion tt uss ntiv vlu ut will not our. W will us inution to ill t lmnts o t rry V, s ollows: Stp 1. V[0][j] = 0 or 0 w W. [i tr r no mins, w will t no vlu]. Stp. To omput V[i][w], onsir two ss: (i) Min i is not purs; in tis s, t st vlu is riv y mkin n optimum sltion rom mins { 1,,, i-1 wit ut o w, wi is intil to V[i-1][w]. (ii) Min i is purs; in tis s, t vlu rom min i = v i. Tror, t rminin mins in t optimum sltion r t st sust rom mins { 1,,, i-1 wit ut = W w i. Tis is t sm s: v i + V[i-1][W-w i ]. Ts r t only possiilitis. Tror, w n onstrut t omplt rry V y usin t ollowin ruls: V[0][w] = 0 or 0 w W, V[i][w] = - or w < 0, V[i][w] = mx{ V[i-1][w], v i + V[i-1][W-w i ] or 1 i n, 0 w W Lt s s numril xmpl or onntin tis to DP: Consir possil st o 4 mins, n ut o. T min osts r: { 5, 4, 6, 3, n t min vlus r: {, 40, 30, 50. T rry V is: w= i= T inl output is V[4][] = 0, wi will our wn w slt to uy mins n 4, spnin = <, wi ws our ut. Now w not tt our ormultion ov xiit ll t rquirmnts o oo nit or DP: () It is n optimiztion prolm

19 () T optiml prolm ontins optiml solutions to su-prolms; tis is lr rom Stp ov. () Mny su-prolms ovrlp: wn omputin t lmnts o t rry, w n to rr to prviously omput lmnts svrl tims. Tis prolm is known y mor mous nm: t 0-1 Knpsk prolm. Hr is t 0-1 knpsk DP loritm: Aloritm: Knpsk( v, w, n, W) Inputs: rry v o vlus; rry w o osts; n = totl numr o ojts; W = ut. 1. or v = 0 to W, V[0][w] = 0;. or i = 1 to n {.1. or w = 0 to W {.1.1. witout-i-vl = V[i-1][w];.1.. i ( w > w[i]) { wit-i-vlu = v[i] + V[i-1][w w[i]].1.3. ls { wit-i-vlu = - ;.1.4. V[i][w] = mx( witout-i-vl, wit-i-vl);.. rturn V[n][V]; Anlysis: Stp 1. O( W+1). Stp. T stp.1. totlly tks onstnt tim; ts stps r xut n(w+1) tims. Tus t loritm is O(nW). Su n loritm is ll psuo-polynomil loritm, sin its run tim is oun y polynomil o som prmtr o t prolm (in tis s, W) otr tn t prolm siz (wi is n). Som onluin rmrks: It tks quit it o rul tout to st up DP ormultions. T 0-1 knpsk prolm is oo introution, sin t rursiv nlysis o t vlus in t rry V n xplin rltivly sily. In mny prtil prolms, it tks som ort n insit to iur out wtr DP n ppli, n to ormult it. Lukily, sin ormultin DP s rquirs som lvrnss, mny pprs pulis out irnt mnuturin systms sin (or oprtions) prolms us DP, n s you will r mor pprs rlt to your tsis rsr, you will surly s mny irnt DP ormultions n t mor xprin wit it.. Complxity lsss: P, NP, NP-omplt Tis topi is ovr in IEEM 6.

20 Biliorpy: Ts nots wr prpr usin t ollowin sours: [1],[CLR]: Introution to Aloritms, TH Cormn, CE Lisrson, RL Rivst, MIT Prss, Cmri MA [] Ltur Nots o Prossor Dvi Mount, Univrsity o Mryln, Computr Sin Dpt. [3] Ltur Nots o Prossor Mori Golin, HKUST, Computr Sin. [4] Oprtions Rsr, F. S. Hillir n G. J. Lirmn, Holn-Dy [*] I pik up t Konisur im rom t w i you know t sour, pls inorm m.

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

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

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

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

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

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

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

, 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

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

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

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

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

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

Grade 7/8 Math Circles March 4/5, Graph Theory I- Solutions

Grade 7/8 Math Circles March 4/5, Graph Theory I- Solutions ulty o Mtmtis Wtrloo, Ontrio N ntr or ution in Mtmtis n omputin r / Mt irls Mr /, 0 rp Tory - Solutions * inits lln qustion. Tr t ollowin wlks on t rp low. or on, stt wtr it is pt? ow o you know? () n

More information

Complete Solutions for MATH 3012 Quiz 2, October 25, 2011, WTT

Complete Solutions for MATH 3012 Quiz 2, October 25, 2011, WTT Complt Solutions or MATH 012 Quiz 2, Otor 25, 2011, WTT Not. T nswrs ivn r r mor omplt tn is xpt on n tul xm. It is intn tt t mor omprnsiv solutions prsnt r will vlul to stunts in stuyin or t inl xm. In

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

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

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

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

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

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

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

d e c b a d c b a d e c b a a c a d c c e b

d e c b a d c b a d e c b a a c a d c c e b FLAT PEYOTE STITCH Bin y mkin stoppr -- sw trou n pull it lon t tr until it is out 6 rom t n. Sw trou t in witout splittin t tr. You soul l to sli it up n own t tr ut it will sty in pl wn lt lon. Evn-Count

More information

OpenMx Matrices and Operators

OpenMx Matrices and Operators OpnMx Mtris n Oprtors Sr Mln Mtris: t uilin loks Mny typs? Dnots r lmnt mxmtrix( typ= Zro", nrow=, nol=, nm="" ) mxmtrix( typ= Unit", nrow=, nol=, nm="" ) mxmtrix( typ= Int", nrow=, nol=, nm="" ) mxmtrix(

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

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

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

Tangram Fractions Overview: Students will analyze standard and nonstandard

Tangram Fractions Overview: Students will analyze standard and nonstandard ACTIVITY 1 Mtrils: Stunt opis o tnrm mstrs trnsprnis o tnrm mstrs sissors PROCEDURE Skills: Dsriin n nmin polyons Stuyin onrun Comprin rtions Tnrm Frtions Ovrviw: Stunts will nlyz stnr n nonstnr tnrms

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

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

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

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

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

CMPS 2200 Fall Graphs. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk

CMPS 2200 Fall Graphs. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk CMPS 2200 Fll 2017 Grps Crol Wnk Sls ourtsy o Crls Lsrson wt ns n tons y Crol Wnk 10/23/17 CMPS 2200 Intro. to Alortms 1 Grps Dnton. A rt rp (rp) G = (V, E) s n orr pr onsstn o st V o vrts (snulr: vrtx),

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

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

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

The University of Sydney MATH 2009

The University of Sydney MATH 2009 T Unvrsty o Syny MATH 2009 APH THEOY Tutorl 7 Solutons 2004 1. Lt t sonnt plnr rp sown. Drw ts ul, n t ul o t ul ( ). Sow tt s sonnt plnr rp, tn s onnt. Du tt ( ) s not somorp to. ( ) A onnt rp s on n

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

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

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

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

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

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

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

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

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

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

BASIC CAGE DETAILS SHOWN 3D MODEL: PSM ASY INNER WALL TABS ARE COINED OVER BASE AND COVER FOR RIGIDITY SPRING FINGERS CLOSED TOP

BASIC CAGE DETAILS SHOWN 3D MODEL: PSM ASY INNER WALL TABS ARE COINED OVER BASE AND COVER FOR RIGIDITY SPRING FINGERS CLOSED TOP MO: PSM SY SI TIS SOWN SPRIN INRS OS TOP INNR W TS R OIN OVR S N OVR OR RIIITY. R TURS US WIT OPTION T SINS. R (UNOMPRSS) RR S OPTION (S T ON ST ) IMNSIONS O INNR SIN TO UNTION WIT QU SM ORM-TOR (zqsp+)

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

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

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

MCS100. One can begin to reason only when a clear picture has been formed in the imagination.

MCS100. One can begin to reason only when a clear picture has been formed in the imagination. 642 ptr 10 Grps n Trs 46. Imin tt t irmsown low is mp wit ountris ll. Is it possil to olor t mp wit only tr olors so tt no two jnt ountris v t sm olor? To nswr tis qustion, rw n nlyz rp in wi ountry is

More information

(4, 2)-choosability of planar graphs with forbidden structures

(4, 2)-choosability of planar graphs with forbidden structures 1 (4, )-oosility o plnr rps wit orin struturs 4 5 Znr Brikkyzy 1 Cristopr Cox Mil Diryko 1 Kirstn Honson 1 Moit Kumt 1 Brnr Liiký 1, Ky Mssrsmit 1 Kvin Moss 1 Ktln Nowk 1 Kvin F. Plmowski 1 Drrik Stol

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

Graph Algorithms and Combinatorial Optimization Presenters: Benjamin Ferrell and K. Alex Mills May 7th, 2014

Graph Algorithms and Combinatorial Optimization Presenters: Benjamin Ferrell and K. Alex Mills May 7th, 2014 Grp Aloritms n Comintoril Optimiztion Dr. R. Cnrskrn Prsntrs: Bnjmin Frrll n K. Alx Mills My 7t, 0 Mtroi Intrstion In ts ltur nots, w mk us o som unonvntionl nottion or st union n irn to kp tins lnr. In

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

(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

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

BASIC CAGE DETAILS D C SHOWN CLOSED TOP SPRING FINGERS INNER WALL TABS ARE COINED OVER BASE AND COVER FOR RIGIDITY

BASIC CAGE DETAILS D C SHOWN CLOSED TOP SPRING FINGERS INNER WALL TABS ARE COINED OVER BASE AND COVER FOR RIGIDITY SI TIS SOWN OS TOP SPRIN INRS INNR W TS R OIN OVR S N OVR OR RIIITY. R IMNSIONS O INNR SIN TO UNTION WIT QU SM ORM-TOR (zqsp+) TRNSIVR. R. RR S OPTION (S T ON ST ) TURS US WIT OPTION T SINS. R (INSI TO

More information

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees /1/018 W usully no strns y ssnn -lnt os to ll rtrs n t lpt (or mpl, 8-t on n ASCII). Howvr, rnt rtrs our wt rnt rquns, w n sv mmory n ru trnsmttl tm y usn vrl-lnt non. T s to ssn sortr os to rtrs tt our

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

Spanning Trees. BFS, DFS spanning tree Minimum spanning tree. March 28, 2018 Cinda Heeren / Geoffrey Tien 1

Spanning Trees. BFS, DFS spanning tree Minimum spanning tree. March 28, 2018 Cinda Heeren / Geoffrey Tien 1 Spnnn Trs BFS, DFS spnnn tr Mnmum spnnn tr Mr 28, 2018 Cn Hrn / Gory Tn 1 Dpt-rst sr Vsts vrts lon snl pt s r s t n o, n tn ktrks to t rst junton n rsums own notr pt Mr 28, 2018 Cn Hrn / Gory Tn 2 Dpt-rst

More information

CMSC 451: Lecture 2 Graph Basics Thursday, Aug 31, 2017

CMSC 451: Lecture 2 Graph Basics Thursday, Aug 31, 2017 Dv Mount CMSC 45: Ltur Grph Bsis Thursy, Au, 07 Rin: Chpt. in KT (Klinr n Tros) n Chpt. in DBV (Dsupt, Ppimitriou, n Vzirni). Som o our trminoloy irs rom our txt. Grphs n Dirphs: A rph G = (V, E) is strutur

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

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

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

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

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

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

Physics 222 Midterm, Form: A

Physics 222 Midterm, Form: A Pysis 222 Mitrm, Form: A Nm: Dt: Hr r som usul onstnts. 1 4πɛ 0 = 9 10 9 Nm 2 /C 2 µ0 4π = 1 10 7 tsl s/c = 1.6 10 19 C Qustions 1 5: A ipol onsistin o two r point-lik prtils wit q = 1 µc, sprt y istn

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

Math 166 Week in Review 2 Sections 1.1b, 1.2, 1.3, & 1.4

Math 166 Week in Review 2 Sections 1.1b, 1.2, 1.3, & 1.4 Mt 166 WIR, Sprin 2012, Bnjmin urisp Mt 166 Wk in Rviw 2 Stions 1.1, 1.2, 1.3, & 1.4 1. S t pproprit rions in Vnn irm tt orrspon to o t ollowin sts. () (B ) B () ( ) B B () (B ) B 1 Mt 166 WIR, Sprin 2012,

More information

Minimum Spanning Trees

Minimum Spanning Trees Yufi Tao ITEE Univrsity of Qunslan In tis lctur, w will stuy anotr classic prolm: finin a minimum spannin tr of an unirct wit rap. Intrstinly, vn tou t prolm appars ratr iffrnt from SSSP (sinl sourc sortst

More information

In which direction do compass needles always align? Why?

In which direction do compass needles always align? Why? AQA Trloy Unt 6.7 Mntsm n Eltromntsm - Hr 1 Complt t p ll: Mnt or s typ o or n t s stronst t t o t mnt. Tr r two typs o mnt pol: n. Wrt wt woul ppn twn t pols n o t mnt ntrtons low: Drw t mnt l lns on

More information

(Minimum) Spanning Trees

(Minimum) Spanning Trees (Mnmum) Spnnn Trs Spnnn trs Kruskl's lortm Novmr 23, 2017 Cn Hrn / Gory Tn 1 Spnnn trs Gvn G = V, E, spnnn tr o G s onnt surp o G wt xtly V 1 s mnml sust o s tt onnts ll t vrts o G G = Spnnn trs Novmr

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

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

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

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

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

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

Divided. diamonds. Mimic the look of facets in a bracelet that s deceptively deep RIGHT-ANGLE WEAVE. designed by Peggy Brinkman Matteliano

Divided. diamonds. Mimic the look of facets in a bracelet that s deceptively deep RIGHT-ANGLE WEAVE. designed by Peggy Brinkman Matteliano RIGHT-ANGLE WEAVE Dv mons Mm t look o ts n rlt tt s ptvly p sn y Py Brnkmn Mttlno Dv your mons nto trnls o two or our olors. FCT-SCON0216_BNB66 2012 Klm Pulsn Co. Ts mtrl my not rprou n ny orm wtout prmsson

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

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

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

DFA Minimization. DFA minimization: the idea. Not in Sipser. Background: Questions: Assignments: Previously: Today: Then:

DFA Minimization. DFA minimization: the idea. Not in Sipser. Background: Questions: Assignments: Previously: Today: Then: Assinmnts: DFA Minimiztion CMPU 24 Lnu Tory n Computtion Fll 28 Assinmnt 3 out toy. Prviously: Computtionl mols or t rulr lnus: DFAs, NFAs, rulr xprssions. Toy: How o w in t miniml DFA or lnu? Tis is t

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

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

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

Experiment # 3 Introduction to Digital Logic Simulation and Xilinx Schematic Editor

Experiment # 3 Introduction to Digital Logic Simulation and Xilinx Schematic Editor EE2L - Introution to Diitl Ciruits Exprimnt # 3 Exprimnt # 3 Introution to Diitl Loi Simultion n Xilinx Smti Eitor. Synopsis: Tis l introus CAD tool (Computr Ai Dsin tool) ll Xilinx Smti Eitor, wi is us

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

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

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

Instruction Scheduling

Instruction Scheduling Instrution Sulin Not y Bris Aktmur: Our slis r pt from Coopr n Torzon s slis tt ty prpr for COMP 412 t Ri. Copyrit 20, Kit D. Coopr & Lin Torzon, ll rits rsrv. Stunts nroll in Comp 412 t Ri Univrsity v

More information

CSCI 104 Graph Representation and Traversals. Mark Redekopp David Kempe

CSCI 104 Graph Representation and Traversals. Mark Redekopp David Kempe 1 CSCI 104 Grp Rprsnttion n Trvrsls Mrk Rkopp Dvi Kmp 2 Oriin o Grp Tory In 1736, Eulr solv t prolm known s t Svn Bris o Könisr. T ity o Könisr, Prussi on t Prl Rivr, inlu two lr islns onnt to otr n t

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

CMSC 451: Lecture 4 Bridges and 2-Edge Connectivity Thursday, Sep 7, 2017

CMSC 451: Lecture 4 Bridges and 2-Edge Connectivity Thursday, Sep 7, 2017 Rn: Not ovr n or rns. CMSC 451: Ltr 4 Brs n 2-E Conntvty Trsy, Sp 7, 2017 Hr-Orr Grp Conntvty: (T ollown mtrl ppls only to nrt rps!) Lt G = (V, E) n onnt nrt rp. W otn ssm tt or rps r onnt, t somtms t

More information