Copyright 2000, Kevin Wayne 1

Size: px
Start display at page:

Download "Copyright 2000, Kevin Wayne 1"

Transcription

1 Chptr 4 4. Intrvl hulng Gry Algorthms ls y Kvn Wyn. Copyrght 005 Prson-Ason Wsly. All rghts rsrv. Intrvl hulng Intrvl hulng: Gry Algorthms Intrvl shulng. Jo strts t s n fnshs t f. Two os omptl f thy on't ovrlp. Gol: fn mxmum sust of mutully omptl os. Gry tmplt. Consr os n som orr. Tk h o prov t's omptl wth th ons lry tkn. [Erlst strt tm] Consr os n snng orr of strt tm s. f g h Tm [Erlst fnsh tm] Consr os n snng orr of fnsh tm f. [hortst ntrvl] Consr os n snng orr of ntrvl lngth f - s. [Fwst onflts] For h o, ount th numr of onfltng os. hul n snng orr of onflts. 3 4 Copyrght 000, Kvn Wyn

2 Intrvl hulng: Gry Algorthms Intrvl hulng: Gry Algorthm Gry tmplt. Consr os n som orr. Tk h o prov t's omptl wth th ons lry tkn. Gry lgorthm. Consr os n nrsng orr of fnsh tm. Tk h o prov t's omptl wth th ons lry tkn. rks rlst strt tm rks shortst ntrvl rks fwst onflts ort os y fnsh tms so tht f f... f n. os slt A f for = to n { f (o omptl wth A) A A È {} } rturn A Implmntton. O(n log n). Rmmr o * tht ws lst to A. Jo s omptl wth A f s ³ f *. 5 6 Intrvl hulng: Anlyss Intrvl hulng: Anlyss Thorm. Gry lgorthm s optml. Thorm. Gry y fnsh tm lgorthm s optml. Pf. (y ontrton) Assum gry s not optml, n lt's s wht hppns. Lt,,... k not st of os slt y gry. Lt,,... m not st of os n th optml soluton wth =, =,..., r = r for th lrgst possl vlu of r. Pf. (y ontrton) Assum gry s not optml, n lt's s wht hppns. Lt,,... k not st of os slt y gry. Lt,,... m not st of os n th optml soluton wth =, =,..., r = r for th lrgst possl vlu of r. o r+ fnshs for r+ o r+ fnshs for r+ Gry: r r+ Gry: r r+ OPT: r r+... OPT: r r+... why not rpl o r+ wth o r+? soluton stll fsl n optml, ut ontrts mxmlty of r. 7 8 Copyrght 000, Kvn Wyn

3 Con Chngng 4. Intrvl Prttonng Gr s goo. Gr s rght. Gr works. Gr lrfs, uts through, n pturs th ssn of th volutonry sprt. - Goron Gko (Mhl Dougls) Intrvl Prttonng Intrvl Prttonng Intrvl prttonng. Ltur strts t s n fnshs t f. Gol: fn mnmum numr of lssrooms to shul ll lturs so tht no two our t th sm tm n th sm room. Intrvl prttonng. Ltur strts t s n fnshs t f. Gol: fn mnmum numr of lssrooms to shul ll lturs so tht no two our t th sm tm n th sm room. Ex: Ths shul uss 4 lssrooms to shul 0 lturs. Ex: Ths shul uss only 3. g f h g f h 9 9:30 0 0:30 :30 :30 :30 :30 3 3:30 4 4:30 Tm 9 9:30 0 0:30 :30 :30 :30 :30 3 3:30 4 4:30 Tm Copyrght 000, Kvn Wyn 3

4 Intrvl Prttonng: Lowr Boun on Optml oluton Intrvl Prttonng: Gry Algorthm Df. Th pth of st of opn ntrvls s th mxmum numr tht ontn ny gvn tm. Gry lgorthm. Consr lturs n nrsng orr of strt tm: ssgn ltur to ny omptl lssroom. Ky osrvton. Numr of lssrooms n ³ pth. Ex: Dpth of shul low = 3 Þ shul low s optml.,, ll ontn 9:30 Q. Dos thr lwys xst shul qul to pth of ntrvls? f ort ntrvls y strtng tm so tht s s... s n. 0 numr of llot lssrooms for = to n { f (ltur s omptl wth som lssroom k) shul ltur n lssroom k ls llot nw lssroom + shul ltur n lssroom + + } g :30 9 9:30 0 0:30 :30 :30 :30 h 3 3:30 4 4:30 Tm Implmntton. O(n log n). For h lssroom k, mntn th fnsh tm of th lst o. Kp th lssrooms n prorty quu. 3 4 Intrvl Prttonng: Gry Anlyss Osrvton. Gry lgorthm nvr shuls two nomptl lturs n th sm lssroom. 4. hulng to Mnmz Ltnss Thorm. Gry lgorthm s optml. Pf. Lt = numr of lssrooms tht th gry lgorthm llots. Clssroom s opn us w n to shul o, sy, tht s nomptl wth ll - othr lssrooms. n w sort y strt tm, ll ths nomptlts r us y lturs tht strt no ltr thn s. Thus, w hv lturs ovrlppng t tm s +. Ky osrvton Þ ll shuls us ³ lssrooms. 5 Copyrght 000, Kvn Wyn 4

5 Announmnts /0/5 UIC Engnrng Crr Fr Tusy, /4/5, :00-4:00, n CE Illnos Rooms UIC Engnrng Wk Atvts: F -8 Wht: Unrgrut Rsum Rvw sson (oph, Jun, nors) Whn: Thursy, Frury 9th, 05 :00m-:00pm Whr: tunt Cntr Est- Room 30 hulng to Mnmzng Ltnss Mnmzng ltnss prolm. ngl rsour prosss on o t tm. Jo rqurs t unts of prossng tm n s u t tm. If strts t tm s, t fnshs t tm f = s + t. Ltnss:! = mx { 0, f - }. Gol: shul ll os to mnmz mxmum ltnss L = mx!. Wht: COE tunt Orgnztons Fr Whn: Thursy, Frury 6th, 05 :00pm-3:00pm Drop y ny tm urng ths hours! Whr: tunt Cntr Est- Room 30 Ex: t Wht: Bowlng & Foo for COE tunts Whn: Fry, Frury 7th, 05 5:00pm-8:00pm Whr: Bowlng Ally n tunt Cntr Est 3 = 9 ltnss = ltnss = 0 = 8 6 = 5 = 6 5 = 4 4 = 9 mx ltnss = Mnmzng Ltnss: Gry Algorthms Mnmzng Ltnss: Gry Algorthms Gry tmplt. Consr os n som orr. Gry tmplt. Consr os n som orr. [hortst prossng tm frst] Consr os n snng orr of prossng tm t. [hortst prossng tm frst] Consr os n snng orr of prossng tm t. [Erlst ln frst] Consr os n snng orr of ln. t ountrxmpl [mllst slk] Consr os n snng orr of slk - t. [mllst slk] Consr os n snng orr of slk - t. t 0 0 ountrxmpl 9 0 Copyrght 000, Kvn Wyn 5

6 Mnmzng Ltnss: Gry Algorthm Mnmzng Ltnss: No Il Tm Gry lgorthm. Erlst ln frst. Osrvton. Thr xsts n optml shul wth no l tm. ort n os y ln so tht n = 4 = = t 0 for = to n Assgn o to ntrvl [t, t + t ] s t, f t + t t t + t output ntrvls [s, f ] = 4 = 6 = Osrvton. Th gry shul hs no l tm. mx ltnss = = 6 = 8 3 = 9 4 = 9 5 = 4 6 = Mnmzng Ltnss: Invrsons Mnmzng Ltnss: Invrsons Df. An nvrson n shul s pr of os n suh tht: < ut shul for. nvrson Df. An nvrson n shul s pr of os n suh tht: < ut shul for. nvrson f for swp for swp ftr swp Osrvton. Gry shul hs no nvrsons. Osrvton. If shul (wth no l tm) hs n nvrson, t hs on wth pr of nvrt os shul onsutvly. f' Clm. wppng two nt, nvrt os rus th numr of nvrsons y on n os not nrs th mx ltnss. Pf. Lt! th ltnss for th swp, n lt! ' t ftrwrs.!' k =! k for ll k ¹,!'! If o s lt: l# = = f # f f l (fnton) ( fnshs t tm f ) ( < ) (fnton) 3 4 Copyrght 000, Kvn Wyn 6

7 Mnmzng Ltnss: Anlyss of Gry Algorthm Gry Anlyss trtgs Thorm. Gry shul s optml. Pf. Dfn * to n optml shul tht hs th fwst numr of nvrsons, n lt's s wht hppns. Cn ssum * hs no l tm. If * hs no nvrsons, thn = *. If * hs n nvrson, lt - n nt nvrson. swppng n os not nrs th mxmum ltnss n strtly rss th numr of nvrsons ths ontrts fnton of * Gry lgorthm stys h. how tht ftr h stp of th gry lgorthm, ts soluton s t lst s goo s ny othr lgorthm's. Exhng rgumnt. Grully trnsform ny soluton to th on foun y th gry lgorthm wthout hurtng ts qulty. truturl. Dsovr smpl "struturl" oun ssrtng tht vry possl soluton must hv rtn vlu. Thn show tht your lgorthm lwys hvs ths oun. 5 6 Optml Offln Chng 4.3 Optml Chng Chng. Ch wth pty to stor k tms. qun of m tm rqusts,,, m. Ch ht: tm lry n h whn rqust. Ch mss: tm not lry n h whn rqust: must rng rqust tm nto h, n vt som xstng tm, f full. Gol. Evton shul tht mnmzs numr of h msss. Ex: k =, ntl h =, rqusts:,,,,,,,. Optml vton shul: h msss. rqusts h 8 Copyrght 000, Kvn Wyn 7

8 Optml Offln Chng: Frthst-In-Futur Ru Evton huls Frthst-n-futur. Evt tm n th h tht s not rqust untl frthst n th futur. Df. A ru shul s shul tht only nsrts n tm nto th h n stp n whh tht tm s rqust. urrnt h: f Intuton. Cn trnsform n unru shul nto ru on wth no mor h msss. futur qurs: g f f g h... h mss t ths on Thorm. [Blly, 960s] FF s optml vton shul. Pf. Algorthm n thorm r ntutv; proof s sutl. x x n unru shul ru shul 9 30 Ru Evton huls Frthst-In-Futur: Anlyss Clm. Gvn ny unru shul, n trnsform t nto ru shul ' wth no mor h msss. Pf. (y nuton on numr of unru tms) uppos rngs nto th h t tm t, wthout rqust. Lt th tm vts whn t rngs nto th h. Cs : vt t tm t', for nxt rqust for. Cs : rqust t tm t' for s vt. t t' t t' vt t tm t', for nxt rqust ' t t' osn't ntr h t rqust tm t t' rqust t tm t' ' Thorm. FF s optml vton lgorthm. Pf. (y nuton on numr or rqusts ) Invrnt: Thr xsts n optml ru shul tht mks th sm vton shul s FF through th frst + rqusts. Lt ru shul tht stsfs nvrnt through rqusts. W prou ' tht stsfs nvrnt ftr + rqusts. Consr (+) st rqust = +. n n FF hv gr up untl now, thy hv th sm h ontnts for rqust +. Cs : ( s lry n th h). ' = stsfs nvrnt. Cs : ( s not n th h n n FF vt th sm lmnt). ' = stsfs nvrnt. Cs Cs 3 3 Copyrght 000, Kvn Wyn 8

9 Frthst-In-Futur: Anlyss Frthst-In-Futur: Anlyss Pf. (ontnu) Cs 3: ( s not n th h; FF vts ; vts f ¹ ). gn onstruton of ' from y vtng nst of f sm f sm f + sm sm f now ' grs wth FF on frst + rqusts; w show tht hvng lmnt f n h s no wors thn hvng lmnt ' ' Lt ' th frst tm ftr + tht n ' tk ffrnt ton, n lt g tm rqust t tm '. must nvolv or f (or oth) ' sm sm f ' Cs 3: g =. Cn't hppn wth Frthst-In-Futur sn thr must rqust for f for. Cs 3: g = f. Elmnt f n't n h of, so lt ' th lmnt tht vts. f ' =, ' sss f from h; now n ' hv sm h f ' ¹, ' vts ' n rngs nto th h; now n ' hv th sm h Not: ' s no longr ru, ut n trnsform nto ru shul tht grs wth FF through stp Frthst-In-Futur: Anlyss Chng Prsptv Lt ' th frst tm ftr + tht n ' tk ffrnt ton, n lt g tm rqust t tm '. ' sm sm f must nvolv or f (or oth) Onln vs. offln lgorthms. Offln: full squn of rqusts s known pror. Onln (rlty): rqusts r not known n vn. Chng s mong most funmntl onln prolms n C. ' othrws ' woul tk th sm ton Cs 3: g ¹, f. must vt. Mk ' vt f; now n ' hv th sm h. ' sm g sm g ' LIFO. Evt pg rought n most rntly. LRU. Evt pg whos most rnt ss ws rlst. FF wth rton of tm rvrs! Thorm. FF s optml offln vton lgorthm. Provs ss for unrstnng n nlyzng onln lgorthms. LRU s k-ompttv. [ton 3.8] LIFO s rtrrly Copyrght 000, Kvn Wyn 9

10 hortst Pth Prolm 4.4 hortst Pths n Grph hortst pth ntwork. Drt grph G = (V, E). our s, stnton t. Lngth! = lngth of g. hortst pth prolm: fn shortst rt pth from s to t. ost of pth = sum of g osts n pth shortst pth from Prnton C prtmnt to Enstn's hous s Cost of pth s--3-5-t = = t 38 Dkstr's Algorthm Dkstr's Algorthm Dkstr's lgorthm. Mntn st of xplor nos for whh w hv trmn th shortst pth stn (u) from s to u. Intlz = { s }, (s) = 0. Rptly hoos unxplor no v whh mnmzs π ( v) = mn = ( u, v) : u v to, n st (v) = p(v). ( u) + l, shortst pth to som u n xplor prt, follow y sngl g (u, v) Dkstr's lgorthm. Mntn st of xplor nos for whh w hv trmn th shortst pth stn (u) from s to u. Intlz = { s }, (s) = 0. Rptly hoos unxplor no v whh mnmzs π ( v) = mn = ( u, v) : u v to, n st (v) = p(v). ( u) + l, shortst pth to som u n xplor prt, follow y sngl g (u, v) (u) u! v (u) u! v s s Copyrght 000, Kvn Wyn 0

11 Dkstr's Algorthm: Proof of Corrtnss Dkstr's Algorthm: Implmntton Invrnt. For h no u Î, (u) s th lngth of th shortst s-u pth. Pf. (y nuton on ) Bs s: = s trvl. Inutv hypothss: Assum tru for = k ³. Lt v nxt no to, n lt u-v th hosn g. Th shortst s-u pth plus (u, v) s n s-v pth of lngth p(v). Consr ny s-v pth P. W'll s tht t's no shortr thn p(v). Lt x-y th frst g n P tht lvs, n lt P' th supth to x. P s lry too long s soon s t lvs.! (P) ³! (P') +! (x,y) ³ (x) +! (x, y) ³ p(y) ³ p(v) nonngtv wghts nutv hypothss fn of p(y) s Dkstr hos v nst of y P' u x P v y For h unxplor no, xpltly mntn π(v) = mn. = (u,v) : u Nxt no to xplor = no wth mnmum p(v). Whn xplorng v, for h nnt g = (v, w), upt π(w) = mn { π(w), π(v)+ l }. Effnt mplmntton. Mntn prorty quu of unxplor nos, prortz y p(v). Prorty Quu PQ Oprton Insrt ExtrtMn ChngKy Dkstr n n m Arry n n Bnry hp log n log n log n -wy Hp log n log n log n F hp log n IsEmpty n Totl n m log n m log m/n n m + n log n Invul ops r mortz ouns 4 4 Esgr W. Dkstr Th quston of whthr omputrs n thnk s lk th quston of whthr sumrns n swm. Extr ls Do only wht only you n o. In thr pty s tool, omputrs wll ut rppl on th surf of our ultur. In thr pty s ntlltul hllng, thy r wthout prnt n th ulturl hstory of mnkn. Th us of COBOL rppls th mn; ts thng shoul, thrfor, rgr s rmnl offn. APL s mstk, rr through to prfton. It s th lngug of th futur for th progrmmng thnqus of th pst: t rts nw gnrton of ong ums. 43 Copyrght 000, Kvn Wyn

12 Con Chngng Con Chngng Gol. Gvn urrny nomntons:, 5, 0, 5, 00, vs mtho to py mount to ustomr usng fwst numr of ons. Ex: 34. Gr s goo. Gr s rght. Gr works. Gr lrfs, uts through, n pturs th ssn of th volutonry sprt. - Goron Gko (Mhl Dougls) Cshr's lgorthm. At h trton, on of th lrgst vlu tht os not tk us pst th mount to p. Ex: $ Con-Chngng: Gry Algorthm Con-Chngng: Anlyss of Gry Algorthm Cshr's lgorthm. At h trton, on of th lrgst vlu tht os not tk us pst th mount to p. ort ons nomntons y vlu: < < < n. ons slt f whl (x ¹ 0) { lt k lrgst ntgr suh tht k x f (k = 0) rturn "no soluton foun" x x - k È {k} } rturn Q. Is shr's lgorthm optml? Thorm. Gr s optml for U.. ong:, 5, 0, 5, 00. Pf. (y nuton on x) Consr optml wy to hng k x < k+ : gry tks on k. W lm tht ny optml soluton must lso tk on k. f not, t ns nough ons of typ,, k- to up to x tl low nts no optml soluton n o ths Prolm rus to on-hngng x - k nts, whh, y nuton, s optmlly solv y gry lgorthm. k k All optml solutons must stsfy P 4 5 N N + D Q 3 no lmt Mx vlu of ons,,, k- n ny OPT = = = Copyrght 000, Kvn Wyn

13 9/8/7 Con-Chngng: Anlyss of Gry Algorthm ltng Brkponts Osrvton. Gry lgorthm s su-optml for U postl nomntons:, 0,, 34, 70, 00, 350, 5, 500. Countrxmpl. 40. Gry: 00, 34,,,,,,. Optml: 70, ltng Brkponts ltng Brkponts: Gry Algorthm ltng rkponts. Ro trp from Prnton to Plo Alto long fx rout. Rfulng sttons t rtn ponts long th wy. Ful pty = C. Truk rvr's lgorthm. ort rkponts so tht: 0 = 0 < < <... < n = L {0} x 0 Gol: mks s fw rfulng stops s possl. Gry lgorthm. Go s fr s you n for rfulng. C Prnton C C C C whl (x ¹ n) lt p lrgst ntgr suh tht p x + C f (p = x) rturn "no soluton" x p È {p} rturn C C 6 rkponts slt urrnt loton Plo Alto Implmntton. O(n log n) Us nry srh to slt h rkpont p. 7 5 Copyrght 000, Kvn Wyn 5 3

14 ltng Brkponts: Corrtnss ltng Brkponts: Corrtnss Thorm. Gry lgorthm s optml. Pf. (y ontrton) Assum gry s not optml, n lt's s wht hppns. Lt 0 = g 0 < g <... < g p = L not st of rkponts hosn y gry. Lt 0 = f 0 < f <... < f q = L not st of rkponts n n optml soluton wth f 0 = g 0, f = g,..., f r = g r for lrgst possl vlu of r. Not: g r+ > f r+ y gry ho of lgorthm. Thorm. Gry lgorthm s optml. Pf. (y ontrton) Assum gry s not optml, n lt's s wht hppns. Lt 0 = g 0 < g <... < g p = L not st of rkponts hosn y gry. Lt 0 = f 0 < f <... < f q = L not st of rkponts n n optml soluton wth f 0 = g 0, f = g,..., f r = g r for lrgst possl vlu of r. Not: g r+ > f r+ y gry ho of lgorthm. g 0 g g g r g r+ g 0 g g g r g r+ Gry: Gry: OPT:... OPT:... f 0 f f f r f r+ f q why osn't optml soluton rv lttl furthr? f 0 f f f r f q nothr optml soluton hs on mor rkpont n ommon Þ ontrton Esgr W. Dkstr Th quston of whthr omputrs n thnk s lk th quston of whthr sumrns n swm. Do only wht only you n o. In thr pty s tool, omputrs wll ut rppl on th surf of our ultur. In thr pty s ntlltul hllng, thy r wthout prnt n th ulturl hstory of mnkn. Th us of COBOL rppls th mn; ts thng shoul, thrfor, rgr s rmnl offn. APL s mstk, rr through to prfton. It s th lngug of th futur for th progrmmng thnqus of th pst: t rts nw gnrton of ong ums. 55 Copyrght 000, Kvn Wyn 4

Copyright 2000, Kevin Wayne 1

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

More information

Copyright 2000, Kevin Wayne 1

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

More information

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

Chapter Interval Scheduling. Greedy Algorithms. What is a Greedy Algorithm? Interval Scheduling

Chapter Interval Scheduling. Greedy Algorithms. What is a Greedy Algorithm? Interval Scheduling Wht s Grdy Algorthm? Chptr Grdy Algorthms Grdy lgorthm Hrd to gv prs dfnton It ulds up soluton n smll stps, hoosng dson t h stp to optmz som undrlyng rtron Mk lol dsons, nd mglly gt glol optmum Vry ffnt

More information

Greedy Algorithms. Greedy Algorithms. Piyush Kumar

Greedy Algorithms. Greedy Algorithms. Piyush Kumar Gree s goo. Gree s rght. Gree works. Gree lrfes, uts through, n ptures the essene of the evolutonry sprt. - Goron Geko (Mhel Dougls) Anlyss of Algorthms Pyush Kumr (Leture 4: Greey Algorthms) Welome to

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

Minimum Spanning Trees

Minimum Spanning Trees Mnmum Spnnng Trs Spnnng Tr A tr (.., connctd, cyclc grph) whch contns ll th vrtcs of th grph Mnmum Spnnng Tr Spnnng tr wth th mnmum sum of wghts 1 1 Spnnng forst If grph s not connctd, thn thr s spnnng

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

Preview. Graph. Graph. Graph. Graph Representation. Graph Representation 12/3/2018. Graph Graph Representation Graph Search Algorithms

Preview. Graph. Graph. Graph. Graph Representation. Graph Representation 12/3/2018. Graph Graph Representation Graph Search Algorithms /3/0 Prvw Grph Grph Rprsntton Grph Srch Algorthms Brdth Frst Srch Corrctnss of BFS Dpth Frst Srch Mnmum Spnnng Tr Kruskl s lgorthm Grph Drctd grph (or dgrph) G = (V, E) V: St of vrt (nod) E: St of dgs

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

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

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

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

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

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

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

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

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

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

Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling hptr Intrvl huling Gry Algorithms lis y Kvin Wyn. opyright 00 Prson-Aison Wsly. All rights rsrv. Th originl vrsion n offiil vrsions r t http://www.s.printon.u/~wyn/ Intrvl huling Intrvl huling: Gry Algorithms

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

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

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

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk S 445 Shortst Paths n Graphs lon frat Sls courtsy of rk man an arola Wnk Paths n raphs onsr a raph G = (V, ) wth -wht functon w : R. Th wht of path p = v v v k s fn to xampl: k = w ( p) = w( v, v + ).

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

Lecture II: Minimium Spanning Tree Algorithms

Lecture II: Minimium Spanning Tree Algorithms Ltur II: Mnmum Spnnn Tr Alortms Dr Krn T. Hrly Dprtmnt o Computr Sn Unvrsty Coll Cork Aprl 0 KH (/0/) Ltur II: Mnmum Spnnn Tr Alortms Aprl 0 / 5 Mnmum Spnnn Trs Mnmum Spnnn Trs Spnnn Tr tr orm rom rp s

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

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

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

Minimum Spanning Trees (CLRS 23)

Minimum Spanning Trees (CLRS 23) Mnmum Spnnn Trs (CLRS 3) T prolm Rll t nton o spnnn tr: Gvn onnt, unrt rp G = (V, E), sust o s o G su tt ty onnt ll vrts n G n orm no yls s ll spnnn tr (ST) o G. Any unrt, onnt rp s spnnn tr. Atully, rp

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

Section 3: Antiderivatives of Formulas

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

More information

(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

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

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

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

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

Graph Search (6A) Young Won Lim 5/18/18

Graph Search (6A) Young Won Lim 5/18/18 Grp Sr (6A) Youn Won Lm Copyrt () 2015 2018 Youn W. Lm. Prmon rnt to opy, trut n/or moy t oumnt unr t trm o t GNU Fr Doumntton Ln, Vron 1.2 or ny ltr vron pul y t Fr Sotwr Founton; wt no Invrnt Ston, no

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

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

Applications of trees

Applications of trees Trs Apptons o trs Orgnzton rts Attk trs to syst Anyss o tr ntworks Prsng xprssons Trs (rtrv o norton) Don-n strutur Mutstng Dstnton-s orwrng Trnsprnt swts Forwrng ts o prxs t routrs Struturs or nt pntton

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

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

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

minimize c'x subject to subject to subject to

minimize c'x subject to subject to subject to z ' sut to ' M ' M N uostrd N z ' sut to ' z ' sut to ' sl vrls vtor of : vrls surplus vtor of : uostrd s s s s s s z sut to whr : ut ost of :out of : out of ( ' gr of h food ( utrt : rqurt for h utrt

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

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

Spanning Tree. Preview. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree 10/17/2017.

Spanning Tree. Preview. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree. Minimum Spanning Tree 10/17/2017. 0//0 Prvw Spnnng Tr Spnnng Tr Mnmum Spnnng Tr Kruskl s Algorthm Prm s Algorthm Corrctnss of Kruskl s Algorthm A spnnng tr T of connctd, undrctd grph G s tr composd of ll th vrtcs nd som (or prhps ll) of

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

, 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

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

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

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

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

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

# 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

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

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

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

Theorem 1. An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices.

Theorem 1. An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices. Cptr 11: Trs 11.1 - Introuton to Trs Dnton 1 (Tr). A tr s onnt unrt rp wt no sp ruts. Tor 1. An unrt rp s tr n ony tr s unqu sp pt twn ny two o ts vrts. Dnton 2. A root tr s tr n w on vrtx s n snt s t

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

b.) v d =? Example 2 l = 50 m, D = 1.0 mm, E = 6 V, " = 1.72 #10 $8 % & m, and r = 0.5 % a.) R =? c.) V ab =? a.) R eq =?

b.) v d =? Example 2 l = 50 m, D = 1.0 mm, E = 6 V,  = 1.72 #10 $8 % & m, and r = 0.5 % a.) R =? c.) V ab =? a.) R eq =? xmpl : An 8-gug oppr wr hs nomnl mtr o. mm. Ths wr rrs onstnt urrnt o.67 A to W lmp. Th nsty o r ltrons s 8.5 x 8 ltrons pr u mtr. Fn th mgntu o. th urrnt nsty. th rt vloty xmpl D. mm,.67 A, n N 8.5" 8

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

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

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

Minimum Spanning Trees (CLRS 23)

Minimum Spanning Trees (CLRS 23) Mnmum Spnnn Trs (CLRS 3) T prolm Gvn onnt, unrt rp G = (V, E), sust o s o G su tt ty onnt ll vrts n G n orm no yls s ll spnnn tr (ST) o G. Clm: Any unrt, onnt rp s spnnn tr (n nrl rp my v mny spnnn trs).

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

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

QUESTIONS BEGIN HERE!

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

More information

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

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

More information

Graph Search Algorithms

Graph Search Algorithms Grp Sr Aortms 1 Grp 2 No ~ ty or omputr E ~ ro or t Unrt or Drt A surprsny r numr o omputton proms n xprss s rp proms. 3 Drt n Unrt Grps () A rt rp G = (V, E), wr V = {1,2,3,4,5,6} n E = {(1,2), (2,2),

More information

The Mathematics of Harmonic Oscillators

The Mathematics of Harmonic Oscillators Th Mhcs of Hronc Oscllors Spl Hronc Moon In h cs of on-nsonl spl hronc oon (SHM nvolvng sprng wh sprng consn n wh no frcon, you rv h quon of oon usng Nwon's scon lw: con wh gvs: 0 Ths s sos wrn usng h

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

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

Algorithm Design and Analysis

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

More information

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

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

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

More information

Exam 2 Solutions. Jonathan Turner 4/2/2012. CS 542 Advanced Data Structures and Algorithms

Exam 2 Solutions. Jonathan Turner 4/2/2012. CS 542 Advanced Data Structures and Algorithms CS 542 Avn Dt Stutu n Alotm Exm 2 Soluton Jontn Tun 4/2/202. (5 ont) Con n oton on t tton t tutu n w t n t 2 no. Wt t mllt num o no tt t tton t tutu oul ontn. Exln you nw. Sn n mut n you o u t n t, t n

More information

Filter Design Techniques

Filter Design Techniques Fltr Dsgn chnqus Fltr Fltr s systm tht psss crtn frquncy componnts n totlly rcts ll othrs Stgs of th sgn fltr Spcfcton of th sr proprts of th systm ppromton of th spcfcton usng cusl scrt-tm systm Rlzton

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

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

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

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

More information

Algorithm Design and Analysis

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

More information

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

Closed Monochromatic Bishops Tours

Closed Monochromatic Bishops Tours Cos Monoromt Bsops Tours Jo DMo Dprtmnt o Mtmts n Sttsts Knnsw Stt Unvrsty, Knnsw, Gor, 0, USA mo@nnsw.u My, 00 Astrt In ss, t sop s unqu s t s o to sn oor on t n wt or. Ts ms os tour n w t sop vsts vry

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

A general N-dimensional vector consists of N values. They can be arranged as a column or a row and can be real or complex.

A general N-dimensional vector consists of N values. They can be arranged as a column or a row and can be real or complex. Lnr lgr Vctors gnrl -dmnsonl ctor conssts of lus h cn rrngd s column or row nd cn rl or compl Rcll -dmnsonl ctor cn rprsnt poston, loct, or cclrton Lt & k,, unt ctors long,, & rspctl nd lt k h th componnts

More information

(A) the function is an eigenfunction with eigenvalue Physical Chemistry (I) First Quiz

(A) the function is an eigenfunction with eigenvalue Physical Chemistry (I) First Quiz 96- Physcl Chmstry (I) Frst Quz lctron rst mss m 9.9 - klogrm, Plnck constnt h 6.66-4 oul scon Sp of lght c. 8 m/s, lctron volt V.6-9 oul. Th functon F() C[cos()+sn()] s n gnfuncton of /. Th gnvlu s (A)

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

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

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

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

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

Last time: introduced our first computational model the DFA.

Last time: introduced our first computational model the DFA. Lctur 7 Homwork #7: 2.2.1, 2.2.2, 2.2.3 (hnd in c nd d), Misc: Givn: M, NFA Prov: (q,xy) * (p,y) iff (q,x) * (p,) (follow proof don in clss tody) Lst tim: introducd our first computtionl modl th DFA. Tody

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

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

Weighted Target Set Selection on Social Networks

Weighted Target Set Selection on Social Networks Wght Trgt St Slton on Sol Ntworks S. Rghvn Th Rort H. Smth Shool of Busnss n Insttut for Systms Rsrh, Unvrsty of Mryln, Mryln 07, USA rghvn@um.u Ru Zhng Ls Shool of Busnss, Unvrsty of Coloro, Boulr, Coloro

More information

Having a glimpse of some of the possibilities for solutions of linear systems, we move to methods of finding these solutions. The basic idea we shall

Having a glimpse of some of the possibilities for solutions of linear systems, we move to methods of finding these solutions. The basic idea we shall Hvn lps o so o t posslts or solutons o lnr systs, w ov to tos o nn ts solutons. T s w sll us s to try to sply t syst y lntn so o t vrls n so ts qutons. Tus, w rr to t to s lnton. T prry oprton nvolv s

More information

INTEGRALS. Chapter 7. d dx. 7.1 Overview Let d dx F (x) = f (x). Then, we write f ( x)

INTEGRALS. Chapter 7. d dx. 7.1 Overview Let d dx F (x) = f (x). Then, we write f ( x) Chptr 7 INTEGRALS 7. Ovrviw 7.. Lt d d F () f (). Thn, w writ f ( ) d F () + C. Ths intgrls r clld indfinit intgrls or gnrl intgrls, C is clld constnt of intgrtion. All ths intgrls diffr y constnt. 7..

More information