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

Size: px
Start display at page:

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

Transcription

1 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 It s sy to dsgn mny grdy lgorthms for sngl prolm, ut only fw n tully solv th prolm Th hrd prt s to prov th lgorthm works lds y Kvn Wyn Copyrght 005 Prson-Addson Wsly All rghts rsrvd *Adustd y Gng Tn for C8: Algorthms t Boston Collg, Fll 05 Intrvl hdulng Intrvl hdulng Intrvl shdulng Jo strts t s nd fnshs t f Two os omptl f thy don't ovrlp Gol: fnd mxmum sust of mutully omptl os d f g h Tm

2 5 A Brut-For rh Intrvl hdulng: Grdy Algorthms n os Fnd ll susts, nd tst thr omptlty n susts Grdy tmplt Consdr os n som ordr Tk h o provdd t's omptl wth th ons lrdy tkn [Erlst strt tm] Consdr os n sndng ordr of strt tm s trt usng rsours s qukly s possl Countr xmpl: d f g h Tm 6 Intrvl hdulng: Anothr Hurst Intrvl hdulng: On Mor Hurst [hortst ntrvl] Consdr os n sndng ordr of ntrvl lngth f -s o tht h o won t oupy th rsour for too long [Fwst onflts] For h o, ount th numr of onfltng os hdul n sndng ordr of onflts Countr xmpl: Countr xmpl: 7 8

3 9 Intrvl hdulng: Grdy Algorthm Th Tmplt of Workng out Grdy Algorthm [Erlst fnsh tm] Consdr os n nrsng ordr of fnsh tm Tk h o provdd t's omptl wth th ons lrdy tkn Insghts Com up wth hurst Exmpl : Exmpl : Fnd on Fgur out Countr xmpl Exmpl : Fnd on ountr xmpl Prov t Try hrdr Works for ll ths xmpls! Flng grt! 0 Intrvl hdulng: Grdy Algorthm Intrvl hdulng: Anlyss Grdy lgorthm Consdr os n nrsng ordr of fnsh tm Tk h o provdd t's omptl wth th ons lrdy tkn ort os y fnsh tms so tht f f f n os sltd A φ for = to n { f (o omptl wth A) A A {} } rturn A Grdy: Thorm Th strtgy of rlst-fnsh-tm s optml Pf (y ontrdton) Assum grdy s not optml, nd lt's s wht hppns Lt,, k dnot st of os sltd y th grdy lgorthm Lt,, m dnot st of os n th optml soluton wth =, =,, r = r for th lrgst possl vlu of r n ll optml solutons r r+ o r+ fnshs for r+ Implmntton O(n log n) Rmmr o * tht ws ddd lst to A Jo s omptl wth A f s f * OPT: r r+ why not rpl o r+ wth o r+?

4 Intrvl hdulng: Anlyss Thorm Th strtgy of rlst-fnsh-tm s optml Intrvl Prttonng Pf (y ontrdton) Assum grdy s not optml, nd lt's s wht hppns Lt,, k dnot st of os sltd y grdy Lt,, m dnot st of os n th optml soluton wth =, =,, r = r for th lrgst possl vlu of r o r+ fnshs for r+ Grdy: r r+ OPT: r r+ soluton stll fsl nd optml, ut ontrdts mxmlty of r Intrvl Prttonng Intrvl Prttonng Intrvl prttonng Ltur strts t s nd fnshs t f Gol: fnd mnmum numr of lssrooms to shdul ll lturs so tht no two our t th sm tm n th sm room Intrvl prttonng Ltur strts t s nd fnshs t f Gol: fnd mnmum numr of lssrooms to shdul ll lturs so tht no two our t th sm tm n th sm room Ex: Ths shdul uss lssrooms to shdul 0 lturs Ex: Ths shdul uss only d g d f h g f h 9 9:0 0 0:0 :0 :0 :0 :0 :0 :0 Tm 9 9:0 0 0:0 :0 :0 :0 :0 :0 :0 Tm 5 6

5 7 Intrvl Prttonng: Lowr Bound on Optml oluton Intrvl Prttonng: Grdy Algorthm Df Th dpth of st of opn ntrvls s th mxmum numr tht pss ovr ny sngl pont on th tm-ln Grdy lgorthm Consdr lturs n nrsng ordr of strt tm: ssgn ltur to ny omptl lssroom Ky osrvton Numr of lssrooms ndd dpth Ex: Dpth of shdul low = shdul low s optml,, ll ontn 9:0 Q Dos thr lwys xst shdul qul to dpth of ntrvls? d f g 9 9:0 0 0:0 :0 :0 :0 :0 h :0 :0 Tm Implmntton O(n log n) For h lssroom k, mntn th fnsh tm of th lst o ddd Kp th lssrooms n prorty quu 8 Intrvl Prttonng: Grdy Anlyss Osrvton Grdy lgorthm nvr shduls two nomptl lturs n th sm lssroom hdulng to Mnmz Ltnss Thorm Evry ntrvl wll ssgnd ll Pf Consdr n ntrvl I uppos thr r k ntrvls rlr tht ovrlp t k+ d I Thus k d - n w hv d lssrooms, w hv t lst on lssroom vll 9

6 hdulng to Mnmzng Ltnss Mnmzng Ltnss: Grdy Algorthms Mnmzng ltnss prolm ngl rsour prosss on o t tm Jo rqurs t unts of prossng tm Jo hs ddln: d If strts t tm s, t fnshs t tm f = s + t Allow ltnss: l = mx { 0, f -d } Gol: shdul ll os to mnmz mxmum ltnss L = mx l 5 6 Grdy tmplt Consdr os n som ordr [hortst prossng tm frst] Consdr os n sndng ordr of prossng tm t [Erlst ddln frst] Consdr os n sndng ordr of ddln d Ex: t d [mllst slk] Consdr os n sndng ordr of slk d -t Jo: 6 5 d = 9 d = 8 d 6 = 5 d = 6 d 5 = d = ltnss = ltnss = 0 mx ltnss = 6 Mnmzng Ltnss: Grdy Algorthms Mnmzng Ltnss: Grdy Algorthms Grdy tmplt Consdr os n som ordr Grdy tmplt Consdr os n som ordr [hortst prossng tm frst] Consdr os n sndng ordr of prossng tm t t 0 d 00 0 [mllst slk] Consdr os n sndng ordr of slk d -t t 0 d 0 slk 0 Aordng to th hurst Ltnss: 0 Aordng to th hurst 0 0 Ltnss: 9 OPT Ltnss: OPT 0 Ltnss:

7 5 urprs Mnmzng Ltnss: No Idl Tm [Erlst ddln frst] Consdr os n sndng ordr of ddln d Ths on works! Although th hurst ompltly gnors t Nxt, w try to prov t Assum os r sortd n sndng ordr of ddln Osrvton Thr xsts n optml shdul wth no dl tm d = d = 6 d = d = d = 6 d = Tht s, f <, thn d d Osrvton Th grdy shdul hs no dl tm 6 Mnmzng Ltnss: Invrsons Mnmzng Ltnss: Invrsons Df An nvrson n shdul s pr of os nd suh tht: < ut shduld for nvrson Df An nvrson n shdul s pr of os nd suh tht: < ut shduld for nvrson f for swp ftr swp f' Osrvton Grdy shdul hs no nvrsons Osrvton If shdul (wth no dl tm) hs n nvrson, t hs on wth pr of nvrtd os shduld onsutvly Why? d d Clm wppng two dnt, nvrtd os rdus th numr of nvrsons y on nd dos not nrs th mx ltnss Pf Lt l th ltnss for th swp, nd lt l ' t ftrwrds l' k = l k for ll k, l' l If o s lt: l = = f d f d f d l (dfnton) ( fnshs t tm f ) ( < ) (dfnton) 7 8

8 9 Mnmzng Ltnss: Anlyss of Grdy Algorthm Mnmzng Ltnss: Grdy Algorthm Thorm Grdy shdul s optml Pf hs no nvrsons Dfn * to n optml shdul tht hs th fwst numr of nvrsons, nd lt's s wht hppns Cn ssum * hs no dl tm If * hs no nvrsons, thn = * If * hs n nvrson, lt - n dnt nvrson swppng nd dos not nrs th mxmum ltnss nd strtly drss th numr of nvrsons ths ontrdts dfnton of * Grdy lgorthm Erlst ddln frst ort n os y ddln so tht d d d n t 0 for = to n Assgn o to ntrvl [t, t + t ] s t, f t + t t t + t output ntrvls [s, f ] mx ltnss = d = 6 d = 8 d = 9 d = 9 d 5 = d 6 = Grdy Anlyss trtgs Grdy lgorthm stys hd how tht ftr h stp of th grdy lgorthm, ts soluton s t lst s good s ny othr lgorthm's Exmpl: Intrvl hdulng Optml Chng Exhng rgumnt Grdully trnsform ny soluton to th on found y th grdy lgorthm wthout hurtng ts qulty Exmpl: hdulng to mnmz ltnss Th most usful strtgy truturl Dsovr smpl "struturl" ound ssrtng tht vry possl soluton must hv rtn vlu Thn show tht your lgorthm lwys hvs ths ound Exmpl: Intrvl prttonng

9 Optml Offln Chng Optml Offln Chng: Frthst-In-Futur Chng Ch wth pty to stor k tms qun of m tm rqusts d, d,, d m Ch ht: tm lrdy n h whn rqustd Ch mss: tm not lrdy n h whn rqustd: must rng rqustd tm nto h, nd vt som xstng tm, f full Frthst-n-futur Evt tm n th h tht s not rqustd untl frthst n th futur urrnt h: d f futur qurs: g d d f d f g h Gol Evton shdul tht mnmzs numr of h msss h mss t ths on Ex: k =, ntl h =, rqusts:,,,,,,, Optml vton shdul: h msss Thorm [Blldy, 960s] FF s optml vton shdul Pf Algorthm nd thorm r ntutv; proof s sutl rqusts h Rdud Evton hduls Rdud Evton hduls Df A rdud shdul s shdul tht only nsrts n tm nto th h n stp n whh tht tm s rqustd Intuton Cn trnsform n unrdud shdul nto rdud on wth no mor h msss x d d d d d d x d n unrdud shdul rdud shdul Clm Gvn ny unrdud shdul, n trnsform t nto rdud shdul ' wth no mor h msss Pf (y nduton on numr of unrdud tms) uppos rngs d nto th h t tm t, wthout rqust Lt th tm vts whn t rngs d nto th h Cs : d vtd t tm t', for nxt rqust for d Cs : d rqustd t tm t' for d s vtd t t' d t t' d vtd t tm t', for nxt rqust ' t t' d dosn't ntr h t rqustd tm t t' d rqustd t tm t' Cs Cs ' d 5 6

10 7 Frthst-In-Futur: Anlyss Frthst-In-Futur: Anlyss Thorm FF s optml vton lgorthm Pf (y nduton on numr or rqusts ) Invrnt: Thr xsts n optml rdud shdul tht mks th sm vton shdul s FF through th frst + rqusts Lt rdud shdul tht stsfs nvrnt through rqusts W produ ' tht stsfs nvrnt ftr + rqusts Consdr (+) st rqust d = d + n nd FF hv grd up untl now, thy hv th sm h ontnts for rqust + Cs : (d s lrdy n th h) ' = stsfs nvrnt Cs : (d s not n th h nd nd FF vt th sm lmnt) ' = stsfs nvrnt Pf (ontnud) Cs : (d s not n th h; FF vts ; vts f ) gn onstruton of ' from y vtng nstd of f sm f sm f ' + sm d sm d f ' now ' grs wth FF on frst + rqusts; w show tht hvng lmnt f n h s no wors thn hvng lmnt 8 Frthst-In-Futur: Anlyss Frthst-In-Futur: Anlyss Lt ' th frst tm ftr + tht nd ' tk dffrnt ton, nd lt g tm rqustd t tm ' must nvolv or f (or oth) Lt ' th frst tm ftr + tht nd ' tk dffrnt ton, nd lt g tm rqustd t tm ' must nvolv or f (or oth) ' sm sm f ' sm sm f ' ' Cs : g = Cn't hppn wth Frthst-In-Futur sn thr must rqust for f for Cs : g = f Elmnt f n't n h of, so lt ' th lmnt tht vts f ' =, ' sss f from h; now nd ' hv sm h f ', ' vts ' nd rngs nto th h; now nd ' hv th sm h Cs : g, f must vt Mk ' vt f; now nd ' hv th sm h ' othrws ' would tk th sm ton sm g sm g ' Not: ' s no longr rdud, ut n trnsformd nto rdud shdul tht grs wth FF through stp + 9 0

11 Chng Prsptv Onln vs offln lgorthms Offln: full squn of rqusts s known pror Onln (rlty): rqusts r not known n dvn Chng s mong most fundmntl onln prolms n C hortst Pths n Grph LIFO Evt pg rought n most rntly LRU Evt pg whos most rnt ss ws rlst FF wth drton of tm rvrsd! Thorm FF s optml offln vton lgorthm Provds ss for undrstndng nd nlyzng onln lgorthms LRU s k-ompttv [ton 8] LIFO s rtrrly d hortst Pth Prolm Dkstr's Algorthm s hortst pth ntwork Drtd grph G = (V, E) Eh dg hs ost l our s, dstnton t hortst pth prolm: fnd shortst drtd pth from s to t ost of pth = sum of dg osts n pth Cost of pth s---5-t = = 8 Hgh lvl Comput th shortst pth from s to ll othr nods ffntly Mntn st of xplord nods for whh w hv dtrmnd th shortst pth For ny u, th dstn d(u) s th ost of th shortst pth from s to u Intlz = { s }, d(s) = 0 Rptd hoos n unxplord nod v to dd to, ordng to som undrlyng rtron---th ommon hrtrsts of Grdy lgorthms 7 t

12 5 Dkstr's Algorthm Dkstr's Algorthm Dkstr's lgorthm Mntn st of xplord nods for whh w hv dtrmnd th shortst pth dstn d(u) from s to u Intlz = { s }, d(s) = 0 Rptdly hoos unxplord nod v whh mnmzs π ( v) = mn = ( u, v) : u dd v to, nd st d(v) = π(v) s ( d( u) + l ), u d(u) u d(u ) shortst pth to v through th xplord prt l l v Dkstr's lgorthm Mntn st of xplord nods for whh w hv dtrmnd th shortst pth dstn d(u) from s to u Intlz = { s }, d(s) = 0 Rptdly hoos unxplord nod v whh mnmzs π ( v) = mn = ( u, v) : u dd v to, nd st d(v) = π(v) s d(u) u l ( d( u) + l ), v Assrtng tht th ost of th shortst pth from s to v s π(v); ths nds proof π(v) = mn {d(u)+ l, d(u )+ l } 6 Dkstr's Algorthm: Proof of Corrtnss Dkstr's Algorthm: Implmntton Invrnt For h nod u, d(u) s th lngth of th shortst s-u pth Pf (y nduton on ) Bs s: = s trvl Indutv hypothss: Assum tru for = k Lt v nxt nod ddd to, nd lt u-v th hosn dg Th shortst s-u pth plus (u, v) s n s-v pth of lngth π(v) Consdr ny s-v pth P W'll s tht t's no shortr thn π(v) Lt x-y th frst dg n P tht lvs, nd lt P' th supth to x P s lrdy too long s soon s t lvs l (P) l (P') + l (x,y) d(x) + l (x, y) π(y) π(v) s P' u x P v y For h unxplord nod, xpltly mntn How to mntn t ffntly? Intlly: = {s}, If thr s n dg (s,w), st π(w)=l (s,w) If thr s no dg (s,w), st π(w)= s u π ( v) = mn ( d( u) + l ) = ( u, v): u v π(w) w nonngtv wghts ndutv hypothss dfn of π(y) Dkstr hos v nstd of y 7 8

13 9 Dkstr's Algorthm: Implmntton Edsgr W Dkstr For h unxplord nod, xpltly mntn How to mntn t ffntly? s d(u) u v π(v) = w π(w) mn = (u,v):u d(u) + l Th quston of whthr omputrs n thnk s lk th quston of whthr sumrns n swm Do only wht only you n do In thr pty s tool, omputrs wll ut rppl on th surf of our ultur In thr pty s ntlltul hllng, thy r wthout prdnt n th ulturl hstory of mnknd d(u) u v Th us of COBOL rppls th mnd; ts thng should, thrfor, rgrdd s rmnl offn l s w Nd to updt π(w) π ( w) = mn d( u) + l = ( u, w): u APL s mstk, rrd through to prfton It s th lngug of th futur for th progrmmng thnqus of th pst: t rts nw gnrton of odng ums Whn ddng v, for h ndnt dg = (v, w), updt π w) = mn{ π ( w), d( v) + l } ( Progrmmng s on of th most dffult rnhs of ppld mthmts; th poorr mthmtns hd ttr rmn pur mthmtns 50 Dkstr's Algorthm: Implmntton lt th smllst π(v): Usng Prorty quus Dkstr's lgorthm Mntn st of xplord nods for whh w hv dtrmnd Rd Ch5 th shortst pth dstn d(u) from s to u Intlz = { s }, d(s) = 0 Rptdly hoos unxplord nod v wth th smllst π(v) Bnry hp-sd prorty quus lt mn log n Chng Ky π ( v) = mn = ( u, v) : u ( d( u) + l ), dd v to, nd st d(v) = π(v) Prorty Quu PQ Oprton Dkstr Arry Bnry hp d-wy Hp F hp W know how to omput π(v) lrdy But How to slt nod v wth th smllst π(v) Insrt ExtrtMn ChngKy n n m n n log n log n log n d log d n d log d n log d n log n IsEmpty n Totl n m log n m log m/n n m + n log n Indvdul ops r mortzd ounds 5 5

14 5 Bnry-Hp Bsd Prorty Quus Bnry-Hp Bsd Prorty Quus: lt Mn A mn hp Th vlu of ny nod s no grtr thn th vlus of ts hldrn Rturn Bnry-Hp Bsd Prorty Quus: lt Mn Bnry-Hp Bsd Prorty Quus: lt Mn Rturn Rturn

15 57 Bnry-Hp Bsd Prorty Quus: lt Mn Bnry-Hp Bsd Prorty Quus: lt Mn Rturn Rturn Bnry-Hp Bsd Prorty Quus: Drs Ky Bnry-Hp Bsd Prorty Quus: Drs Ky 9 -> 9 ->

16 6 Bnry-Hp Bsd Prorty Quus: Drs Ky Bnry-Hp Bsd Prorty Quus: Drs Ky 9 -> 9 -> Extr lds Con Chngng Grd s good Grd s rght Grd works Grd lrfs, uts through, nd pturs th ssn of th volutonry sprt - Gordon Gko (Mhl Dougls)

17 65 Con Chngng Con-Chngng: Grdy Algorthm Gol Gvn urrny dnomntons:, 5, 0, 5, 00, dvs mthod to py mount to ustomr usng fwst numr of ons Cshr's lgorthm At h trton, dd on of th lrgst vlu tht dos not tk us pst th mount to pd Ex: Cshr's lgorthm At h trton, dd on of th lrgst vlu tht dos not tk us pst th mount to pd Ex: $89 ort ons dnomntons y vlu: < < < n ons sltd φ whl (x 0) { lt k lrgst ntgr suh tht k x f (k = 0) rturn "no soluton found" x x - k {k} } rturn Q Is shr's lgorthm optml? 66 Con-Chngng: Anlyss of Grdy Algorthm Con-Chngng: Anlyss of Grdy Algorthm Thorm Grd s optml for U ong:, 5, 0, 5, 00 Pf (y nduton on x) Consdr optml wy to hng k x < k+ : grdy tks on k W lm tht ny optml soluton must lso tk on k f not, t nds nough ons of typ,, k- to dd up to x tl low ndts no optml soluton n do ths Prolm rdus to on-hngng x - k nts, whh, y nduton, s optmlly solvd y grdy lgorthm Osrvton Grdy lgorthm s su-optml for U postl dnomntons:, 0,,, 70, 00, 50, 5, 500 Countrxmpl 0 Grdy: 00,,,,,,, Optml: 70, 70 k 5 k All optml solutons must stsfy P 5 N N + D Q no lmt Mx vlu of ons,,, k- n ny OPT = = 75 + =

18 ltng Brkponts ltng Brkponts ltng rkponts Rod trp from Prnton to Plo Alto long fxd rout Rfulng sttons t rtn ponts long th wy Ful pty = C Gol: mks s fw rfulng stops s possl Grdy lgorthm Go s fr s you n for rfulng C C C C Prnton C C C Plo Alto ltng Brkponts: Grdy Algorthm ltng Brkponts: Corrtnss Truk drvr's lgorthm ort rkponts so tht: 0 = 0 < < < < n = L {0} x 0 rkponts sltd urrnt loton whl (x n ) lt p lrgst ntgr suh tht p x + C f ( p = x) rturn "no soluton" x p {p} rturn Grdy: Thorm Grdy lgorthm s optml Pf (y ontrdton) Assum grdy s not optml, nd lt's s wht hppns Lt 0 = g 0 < g < < g p = L dnot st of rkponts hosn y grdy Lt 0 = f 0 < f < < f q = L dnot 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 grdy ho of lgorthm g 0 g g g r g r+ Implmntton O(n log n) Us nry srh to slt h rkpont p OPT: f 0 f f f r f r+ f q why dosn't optml soluton drv lttl furthr? 7 7

19 7 ltng Brkponts: Corrtnss Thorm Grdy lgorthm s optml Pf (y ontrdton) Assum grdy s not optml, nd lt's s wht hppns Lt 0 = g 0 < g < < g p = L dnot st of rkponts hosn y grdy Lt 0 = f 0 < f < < f q = L dnot 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 grdy ho of lgorthm Grdy: g 0 g g g r g r+ OPT: f 0 f f f r f q nothr optml soluton hs on mor rkpont n ommon ontrdton

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 Chptr 4 4. Intrvl hulng Gry Algorthms ls y Kvn Wyn. Copyrght 005 Prson-Ason Wsly. All rghts rsrv. Intrvl hulng Intrvl hulng: Gry Algorthms Intrvl shulng. Jo strts t s n fnshs t f. Two os omptl f thy on't

More information

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

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

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

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

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

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

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

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

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. 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

Single Source Shortest Paths (with Positive Weights)

Single Source Shortest Paths (with Positive Weights) Snl Sour Sortst Pts (wt Postv Wts) Yuf To ITEE Unvrsty of Qunslnd In ts ltur, w wll rvst t snl sour sortst pt (SSSP) problm. Rll tt w v lrdy lrnd tt t BFS lortm solvs t problm ffntly wn ll t ds v t sm

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 //0 Rmrks ou Dksr s Algorhm C 0: Algorhm Dsgn nd Anlyss Ylds shors ph r from orgn s. hors ph from s o vry ohr nod v Chpr Jrmh Blok Purdu Unvrsy prng 0 Grdy Algorhms Rmndr: Homwork du ongh :9PM! lds y Kvn

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(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

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

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

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

(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

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

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

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 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

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

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

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

More information

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

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

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

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

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

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

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

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

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

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

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

Convergence Theorems for Two Iterative Methods. A stationary iterative method for solving the linear system: (1.1)

Convergence Theorems for Two Iterative Methods. A stationary iterative method for solving the linear system: (1.1) Conrgnc Thors for Two Itrt Mthods A sttonry trt thod for solng th lnr syst: Ax = b (.) ploys n trton trx B nd constnt ctor c so tht for gn strtng stt x of x for = 2... x Bx c + = +. (.2) For such n trton

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

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

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. 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

# 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

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

8. Linear Contracts under Risk Neutrality

8. Linear Contracts under Risk Neutrality 8. Lnr Contrcts undr Rsk Nutrlty Lnr contrcts r th smplst form of contrcts nd thy r vry populr n pplctons. Thy offr smpl ncntv mchnsm. Exmpls of lnr contrcts r mny: contrctul jont vnturs, quty jont vnturs,

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

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

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 417, Winter Greedy Algorithms 1/27/2012. Chapter 4. Ben Birnbaum Widad Machmouchi. 4.1 Interval Scheduling.

CSE 417, Winter Greedy Algorithms 1/27/2012. Chapter 4. Ben Birnbaum Widad Machmouchi. 4.1 Interval Scheduling. //0 CSE, Wntr 0 Grdy Algorthms Chaptr Grdy Algorthms Bn Brnbaum Wdad Machmouch Slds by Kvn Wayn. Copyrght 00 Parson-Addson Wsly. All rghts rsrvd. Slds adaptd rom Larry Ruzzo, Stv Tanmoto, and Kvn Wayn

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

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

Lucas Test is based on Euler s theorem which states that if n is any integer and a is coprime to n, then a φ(n) 1modn.

Lucas Test is based on Euler s theorem which states that if n is any integer and a is coprime to n, then a φ(n) 1modn. Modul 10 Addtonal Topcs 10.1 Lctur 1 Prambl: Dtrmnng whthr a gvn ntgr s prm or compost s known as prmalty tstng. Thr ar prmalty tsts whch mrly tll us whthr a gvn ntgr s prm or not, wthout gvng us th factors

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

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

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

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

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

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

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

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

Chapter 16. 1) is a particular point on the graph of the function. 1. y, where x y 1

Chapter 16. 1) is a particular point on the graph of the function. 1. y, where x y 1 Prctic qustions W now tht th prmtr p is dirctl rltd to th mplitud; thrfor, w cn find tht p. cos d [ sin ] sin sin Not: Evn though ou might not now how to find th prmtr in prt, it is lws dvisl to procd

More information

, between the vertical lines x a and x b. Given a demand curve, having price as a function of quantity, p f (x) at height k is the curve f ( x,

, between the vertical lines x a and x b. Given a demand curve, having price as a function of quantity, p f (x) at height k is the curve f ( x, Clculus for Businss nd Socil Scincs - Prof D Yun Finl Em Rviw vrsion 5/9/7 Chck wbsit for ny postd typos nd updts Pls rport ny typos This rviw sht contins summris of nw topics only (This rviw sht dos hv

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

Formal Concept Analysis

Formal Concept Analysis Forml Conpt Anlysis Conpt intnts s losd sts Closur Systms nd Implitions 4 Closur Systms 0.06.005 Nxt-Closur ws dvlopd y B. Gntr (984). Lt M = {,..., n}. A M is ltilly smllr thn B M, if B A if th smllst

More information

Winter 2016 COMP-250: Introduction to Computer Science. Lecture 23, April 5, 2016

Winter 2016 COMP-250: Introduction to Computer Science. Lecture 23, April 5, 2016 Wintr 2016 COMP-250: Introduction to Computr Scinc Lctur 23, April 5, 2016 Commnt out input siz 2) Writ ny lgorithm tht runs in tim Θ(n 2 log 2 n) in wors cs. Explin why this is its running tim. I don

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

Partially Observable Systems. 1 Partially Observable Markov Decision Process (POMDP) Formalism

Partially Observable Systems. 1 Partially Observable Markov Decision Process (POMDP) Formalism CS294-40 Lernng for Rootcs nd Control Lecture 10-9/30/2008 Lecturer: Peter Aeel Prtlly Oservle Systems Scre: Dvd Nchum Lecture outlne POMDP formlsm Pont-sed vlue terton Glol methods: polytree, enumerton,

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

SAMPLE LITANY OF THE SAINTS E/G. Dadd9/F. Aadd9. cy. Christ, have. Lord, have mer cy. Christ, have A/E. Dadd9. Aadd9/C Bm E. 1. Ma ry and. mer cy.

SAMPLE LITANY OF THE SAINTS E/G. Dadd9/F. Aadd9. cy. Christ, have. Lord, have mer cy. Christ, have A/E. Dadd9. Aadd9/C Bm E. 1. Ma ry and. mer cy. LTNY OF TH SNTS Cntrs Gnt flwng ( = c. 100) /G Ddd9/F ll Kybrd / hv Ddd9 hv hv Txt 1973, CL. ll rghts rsrvd. Usd wth prmssn. Musc: D. Bckr, b. 1953, 1987, D. Bckr. Publshd by OCP. ll rghts rsrvd. SMPL

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

Ch 1.2: Solutions of Some Differential Equations

Ch 1.2: Solutions of Some Differential Equations Ch 1.2: Solutions of Som Diffrntil Equtions Rcll th fr fll nd owl/mic diffrntil qutions: v 9.8.2v, p.5 p 45 Ths qutions hv th gnrl form y' = y - b W cn us mthods of clculus to solv diffrntil qutions of

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

The R-Tree. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland

The R-Tree. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland Yu To ITEE Unvrsty o Qunsln W wll stuy nw strutur ll t R-tr, w n tout o s mult-mnsonl xtnson o t B-tr. T R-tr supports ntly vrty o qurs (s w wll n out ltr n t ours), n s mplmnt n numrous ts systms. Our

More information

Section 5.1/5.2: Areas and Distances the Definite Integral

Section 5.1/5.2: Areas and Distances the Definite Integral Scto./.: Ars d Dstcs th Dt Itgrl Sgm Notto Prctc HW rom Stwrt Ttook ot to hd p. #,, 9 p. 6 #,, 9- odd, - odd Th sum o trms,,, s wrtt s, whr th d o summto Empl : Fd th sum. Soluto: Th Dt Itgrl Suppos w

More information

Multi-Section Coupled Line Couplers

Multi-Section Coupled Line Couplers /0/009 MultiSction Coupld Lin Couplrs /8 Multi-Sction Coupld Lin Couplrs W cn dd multipl coupld lins in sris to incrs couplr ndwidth. Figur 7.5 (p. 6) An N-sction coupld lin l W typiclly dsign th couplr

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

Abhilasha Classes Class- XII Date: SOLUTION (Chap - 9,10,12) MM 50 Mob no

Abhilasha Classes Class- XII Date: SOLUTION (Chap - 9,10,12) MM 50 Mob no hlsh Clsses Clss- XII Dte: 0- - SOLUTION Chp - 9,0, MM 50 Mo no-996 If nd re poston vets of nd B respetvel, fnd the poston vet of pont C n B produed suh tht C B vet r C B = where = hs length nd dreton

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

CONTINUITY AND DIFFERENTIABILITY

CONTINUITY AND DIFFERENTIABILITY MCD CONTINUITY AND DIFFERENTIABILITY NCERT Solvd mpls upto th sction 5 (Introduction) nd 5 (Continuity) : Empl : Chck th continuity of th function f givn by f() = + t = Empl : Emin whthr th function f

More information