4. GREEDY ALGORITHMS I
|
|
- Marion Ramsey
- 6 years ago
- Views:
Transcription
1 4. GREEDY ALGORITHMS I coin chnging intervl scheduling scheduling to minimize lteness optiml cching Lecture slides by Kevin Wyne Copyright 2005 Person-Addison Wesley Lst updted on Feb 17, :07 AM
2 4. GREEDY ALGORITHMS I coin chnging intervl scheduling scheduling to minimize lteness optiml cching
3 Coin chnging Gol. Given currency denomintions: 1, 5, 10, 25, 100, devise method to py mount to customer using fewest number of coins. Ex. 34. Cshier's lgorithm. At ech itertion, dd coin of the lrgest vlue tht does not tke us pst the mount to be pid. Ex. $
4 Cshier's lgorithm At ech itertion, dd coin of the lrgest vlue tht does not tke us pst the mount to be pid. CASHIERSALGORITHM(x, c1, c2,, cn) SORT n coin denomintions so tht c1 < c2 < < cn S φ WHILE x > 0 k lrgest coin denomintion ck such tht ck x IF no such k, RETURN "no solution" ELSE RETURN S x x ck S S { k } set of coins selected Q. Is cshier's lgorithm optiml? 4
5 Properties of optiml solution Property. Number of pennies 4. Pf. Replce 5 pennies with 1 nickel. Property. Number of nickels 1. Property. Number of qurters 3. Property. Number of nickels + number of dimes 2. Pf. Replce 3 dimes nd 0 nickels with 1 qurter nd 1 nickel; Replce 2 dimes nd 1 nickel with 1 qurter. Recll: t most 1 nickel. 5
6 Anlysis of cshier's lgorithm Theorem. Cshier's lgorithm is optiml for U.S. coins: 1, 5, 10, 25, 100. Pf. [by induction on x] Consider optiml wy to chnge c k x < c k+1 : greedy tkes coin k. We clim tht ny optiml solution must lso tke coin k. if not, it needs enough coins of type c 1,, c k 1 to dd up to x tble below indictes no optiml solution cn do this Problem reduces to coin-chnging x c k cents, which, by induction, is optimlly solved by cshier's lgorithm. k ck ll optiml solutions must stisfy mx vlue of coins c1, c2,, ck 1 in ny OPT 1 1 P N N + D Q no limit = = = 99 6
7 Cshier's lgorithm for other denomintions Q. Is cshier's lgorithm for ny set of denomintions? A. No. Consider U.S. postge: 1, 10, 21, 34, 70, 100, 350, 1225, Cshier's lgorithm: 140 = Optiml: 140 = A. No. It my not even led to fesible solution if c1 > 1: 7, 8, 9. Cshier's lgorithm: 15 = 9 +???. Optiml: 15 =
8 4. GREEDY ALGORITHMS I coin chnging intervl scheduling scheduling to minimize lteness optiml cching SECTION 4.1
9 Intervl scheduling Job j strts t s j nd finishes t f j. Two jobs comptible if they don't overlp. Gol: find mximum subset of mutully comptible jobs. b c d e jobs d nd g re incomptible f g h time 9
10 Intervl scheduling: greedy lgorithms Greedy templte. Consider jobs in some nturl order. Tke ech job provided it's comptible with the ones lredy tken. [Erliest strt time] Consider jobs in scending order of s j. [Erliest finish time] Consider jobs in scending order of f j. [Shortest intervl] Consider jobs in scending order of f j s j. [Fewest conflicts] For ech job j, count the number of conflicting jobs c j. Schedule in scending order of c j. 10
11 Intervl scheduling: greedy lgorithms Greedy templte. Consider jobs in some nturl order. Tke ech job provided it's comptible with the ones lredy tken. counterexmple for erliest strt time counterexmple for shortest intervl counterexmple for fewest conflicts 11
12 Intervl scheduling: erliest-finish-time-first lgorithm EARLIESTFINISHTIMEFIRST(n, s1, s2,, sn, f1, f2,, fn) SORT jobs by finish time so tht f1 f2 fn A φ FOR j = 1 TO n IF job j is comptible with A A A { j } RETURN A set of jobs selected Proposition. Cn implement erliest-finish-time first in O(n log n) time. Keep trck of job j* tht ws dded lst to A. Job j is comptible with A iff s j f j*. Sorting by finish time tkes O(n log n) time. 12
13 Intervl scheduling: nlysis of erliest-finish-time-first lgorithm Theorem. The erliest-finish-time-first lgorithm is optiml. Pf. [by contrdiction] Assume greedy is not optiml, nd let's see wht hppens. Let i 1, i 2,... i k denote set of jobs selected by greedy. Let j 1, j 2,... j m denote set of jobs in n optiml solution with i 1 = j 1, i 2 = j 2,..., i r = j r for the lrgest possible vlue of r. job i r+1 exists nd finishes before j r+1 Greedy: i 1 i 2 i r i r+1... i k OPT: j 1 j 2 j r j r+1... j m why not replce job j r+1 with job i r+1? 13
14 Intervl scheduling: nlysis of erliest-finish-time-first lgorithm Theorem. The erliest-finish-time first lgorithm is optiml. Pf. [by contrdiction] Assume greedy is not optiml, nd let's see wht hppens. Let i 1, i 2,... i k denote set of jobs selected by greedy. Let j 1, j 2,... j m denote set of jobs in n optiml solution with i 1 = j 1, i 2 = j 2,..., i r = j r for the lrgest possible vlue of r. job i r+1 exists nd finishes before j r+1 Greedy:... i 1 i 2 i r i r+1 i k OPT: j 1 j 2 j r i r+1... j m solution still fesible nd optiml (but contrdicts mximlity of r) 14
15 Intervl prtitioning Intervl prtitioning. Lecture j strts t s j nd finishes t f j. Gol: find minimum number of clssrooms to schedule ll lectures so tht no two lectures occur t the sme time in the sme room. Ex. This schedule uses 4 clssrooms to schedule 10 lectures. 4 e j 3 c d g 2 b h 1 f i 9 9: : : :30 1 1:30 2 2:30 3 3:30 4 4:30 time 15
16 Intervl prtitioning Intervl prtitioning. Lecture j strts t s j nd finishes t f j. Gol: find minimum number of clssrooms to schedule ll lectures so tht no two lectures occur t the sme time in the sme room. Ex. This schedule uses 3 clssrooms to schedule 10 lectures. 3 c d f j 2 b g i 1 e h 9 9: : : :30 1 1:30 2 2:30 3 3:30 4 4:30 time 16
17 Intervl prtitioning: greedy lgorithms Greedy templte. Consider lectures in some nturl order. Assign ech lecture to n vilble clssroom (which one?); llocte new clssroom if none re vilble. [Erliest strt time] Consider lectures in scending order of s j. [Erliest finish time] Consider lectures in scending order of f j. [Shortest intervl] Consider lectures in scending order of f j s j. [Fewest conflicts] For ech lecture j, count the number of conflicting lectures c j. Schedule in scending order of c j. 17
18 Intervl prtitioning: greedy lgorithms Greedy templte. Consider lectures in some nturl order. Assign ech lecture to n vilble clssroom (which one?); llocte new clssroom if none re vilble. counterexmple for erliest finish time counterexmple for shortest intervl counterexmple for fewest conflicts
19 Intervl prtitioning: erliest-strt-time-first lgorithm EARLIESTSTARTTIMEFIRST(n, s1, s2,, sn, f1, f2,, fn) SORT lectures by strt time so tht s1 s2 sn. d 0 FOR j = 1 TO n IF lecture j is comptible with some clssroom Schedule lecture j in ny such clssroom k. ELSE number of llocted clssrooms Allocte new clssroom d + 1. Schedule lecture j in clssroom d + 1. d d + 1 RETURN schedule. 19
20 Intervl prtitioning: erliest-strt-time-first lgorithm Proposition. The erliest-strt-time-first lgorithm cn be implemented in O(n log n) time. Pf. Store clssrooms in priority queue (key = finish time of its lst lecture). To determine whether lecture j is comptible with some clssroom, compre sj to key of min clssroom k in priority queue. To dd lecture j to clssroom k, increse key of clssroom k to f j. Totl number of priority queue opertions is O(n). Sorting by strt time tkes O(n log n) time. Remrk. This implementtion chooses the clssroom k whose finish time of its lst lecture is the erliest. 20
21 Intervl prtitioning: lower bound on optiml solution Def. The depth of set of open intervls is the mximum number tht contin ny given time. Key observtion. Number of clssrooms needed depth. Q. Does number of clssrooms needed lwys equl depth? A. Yes! Moreover, erliest-strt-time-first lgorithm finds one. depth = 3 3 c d f j 2 b g i 1 e h 9 9: : : :30 1 1:30 2 2:30 3 3:30 4 4:30 time 21
22 Intervl prtitioning: nlysis of erliest-strt-time-first lgorithm Observtion. The erliest-strt-time first lgorithm never schedules two incomptible lectures in the sme clssroom. Theorem. Erliest-strt-time-first lgorithm is optiml. Pf. Let d = number of clssrooms tht the lgorithm lloctes. Clssroom d is opened becuse we needed to schedule lecture, sy j, tht is incomptible with ll d 1 other clssrooms. These d lectures ech end fter s j. Since we sorted by strt time, ll these incomptibilities re cused by lectures tht strt no lter thn s j. Thus, we hve d lectures overlpping t time s j + ε. Key observtion ll schedules use d clssrooms. 22
23 4. GREEDY ALGORITHMS I coin chnging intervl scheduling scheduling to minimize lteness optiml cching SECTION 4.2
24 Scheduling to minimizing lteness Minimizing lteness problem. Single resource processes one job t time. Job j requires t j units of processing time nd is due t time d j. If j strts t time s j, it finishes t time f j = s j + t j. Lteness: j = mx { 0, f j d j }. Gol: schedule ll jobs to minimize mximum lteness L = mx j j t j d j lteness = 2 lteness = 0 mx lteness = 6 d 3 = 9 d 2 = 8 d 6 = 15 d 1 = 6 d 5 = 14 d 4 =
25 Minimizing lteness: greedy lgorithms Greedy templte. Schedule jobs ccording to some nturl order. [Shortest processing time first] Schedule jobs in scending order of processing time t j. [Erliest dedline first] Schedule jobs in scending order of dedline d j. [Smllest slck] Schedule jobs in scending order of slck d j t j. 25
26 Minimizing lteness: greedy lgorithms Greedy templte. Schedule jobs ccording to some nturl order. [Shortest processing time first] Schedule jobs in scending order of processing time t j. 1 2 counterexmple tj dj [Smllest slck] Schedule jobs in scending order of slck d j t j. 1 2 tj dj counterexmple 26
27 Minimizing lteness: erliest dedline first EARLIESTDEADLINEFIRST(n, t1, t2,, tn, d1, d2,, dn) SORT n jobs so tht d1 d2 dn. t 0 FOR j = 1 TO n Assign job j to intervl [t, t +tj]. sj t ; fj t + tj t t + tj RETURN intervls [s1, f1], [s2, f2],, [sn, fn]. mx lteness = 1 d 1 = 6 d 2 = 8 d 3 = 9 d 4 = 9 d 5 = 14 d 6 =
28 Minimizing lteness: no idle time Observtion 1. There exists n optiml schedule with no idle time. d = 4 d = d = d = 4 d = 6 d = Observtion 2. The erliest-dedline-first schedule hs no idle time. 28
29 Minimizing lteness: inversions Def. Given schedule S, n inversion is pir of jobs i nd j such tht: i < j but j scheduled before i. inversion f i j i [ s before, we ssume jobs re numbered so tht d 1 d 2 d n ] Observtion 3. The erliest-dedline-first schedule hs no inversions. Observtion 4. If schedule (with no idle time) hs n inversion, it hs one with pir of inverted jobs scheduled consecutively. 29
30 Minimizing lteness: inversions Def. Given schedule S, n inversion is pir of jobs i nd j such tht: i < j but j scheduled before i. inversion f i before swp j i fter swp i j f ' j Clim. Swpping two djcent, inverted jobs reduces the number of inversions by one nd does not increse the mx lteness. Pf. Let be the lteness before the swp, nd let ' be it fterwrds. ' k = k for ll k i, j. ' i i. If job j is lte, ' j = f 'j dj (definition) = f i d j ( j now finishes t time f i ) f i d i (since i nd j inverted) i. (definition) 30
31 Minimizing lteness: nlysis of erliest-dedline-first lgorithm Theorem. The erliest-dedline-first schedule S is optiml. Pf. [by contrdiction] Define S* to be n optiml schedule tht hs the fewest number of inversions, nd let's see wht hppens. Cn ssume S* hs no idle time. If S* hs no inversions, then S = S*. If S* hs n inversion, let i j be n djcent inversion. Swpping i nd j does not increse the mx lteness strictly decreses the number of inversions This contrdicts definition of S* 31
32 Greedy nlysis strtegies Greedy lgorithm stys hed. Show tht fter ech step of the greedy lgorithm, its solution is t lest s good s ny other lgorithm's. Structurl. Discover simple "structurl" bound sserting tht every possible solution must hve certin vlue. Then show tht your lgorithm lwys chieves this bound. Exchnge rgument. Grdully trnsform ny solution to the one found by the greedy lgorithm without hurting its qulity. Other greedy lgorithms. Gle-Shpley, Kruskl, Prim, Dijkstr, Huffmn, 32
33 4. GREEDY ALGORITHMS I coin chnging intervl scheduling scheduling to minimize lteness optiml cching SECTION 4.3
34 Optiml offline cching Cching. Cche with cpcity to store k items. Sequence of m item requests d 1, d 2,, d m. Cche hit: item lredy in cche when requested. Cche miss: item not lredy in cche when requested: must bring requested item into cche, nd evict some existing item, if full. Gol. Eviction schedule tht minimizes number of evictions. Ex. k = 2, initil cche = b, requests:, b, c, b, c,,. Optiml eviction schedule. 2 evictions. b c c b b b cche miss (eviction) b c b c c b b b b requests cche 34
35 Optiml offline cching: greedy lgorithms LIFO / FIFO. Evict element brought in most (est) recently. LRU. Evict element whose most recent ccess ws erliest. LFU. Evict element tht ws lest frequently requested. previous queries w x y z FIFO: eject d w x d z LRU: eject d w x d z b b x d z c b c d z current cche e b c d e LIFO: eject e cche miss (which item to eject?) g b e d future queries 35
36 Optiml offline cching: frthest-in-future (clirvoynt lgorithm) Frthest-in-future. Evict item in the cche tht is not requested until frthest in the future. current cche cche miss (which item to eject?) f b c e g b e b c d e d FF: eject d future queries Theorem. [Bélády 1966] FF is optiml eviction schedule. Pf. Algorithm nd theorem re intuitive; proof is subtle. 36
37 Reduced eviction schedules Def. A reduced schedule is schedule tht only inserts n item into the cche in step in which tht item is requested. b c item inserted when not requested b c x c b c c d c c b c d d b d d c c b d c b x b b d b c c b c c b b c b c b c b c n unreduced schedule reduced schedule 37
38 Reduced eviction schedules Clim. Given ny unreduced schedule S, cn trnsform it into reduced schedule S' with no more evictions. Pf. [by induction on number of unreduced items] Suppose S brings d into the cche t time t, without request. Let c be the item S evicts when it brings d into the cche. Cse 1: d evicted t time t', before next request for d. unreduced schedule S.. c.. c Cse 1 S'.. c.. c.. c.. c time t time t' d e.. d.. d.. d.. e.. e d enters cche without request d evicted before next request d e.. c.. c.. c.. e.. e might s well leve c in cche 38
39 Reduced eviction schedules Clim. Given ny unreduced schedule S, cn trnsform it into reduced schedule S' with no more evictions. Pf. [by induction on number of unreduced items] Suppose S brings d into the cche t time t, without request. Let c be the item S evicts when it brings d into the cche. Cse 1: d evicted t time t', before next request for d. Cse 2: d requested t time t' before d is evicted. unreduced schedule S.. c.. c Cse 2 S'.. c.. c.. c.. c time t d time t' d.. d.. d.. d.. d.. d d enters cche without request d requested before d evicted d d.. c.. c.. c.. d.. d might s well leve c in cche until d is requested 39
40 Frthest-in-future: nlysis Theorem. FF is optiml eviction lgorithm. Pf. Follows directly from invrint. Invrint. There exists n optiml reduced schedule S tht mkes the sme eviction schedule s S FF through the first j requests. Pf. [by induction on j] Let S be reduced schedule tht stisfies invrint through j requests. We produce S' tht stisfies invrint fter j + 1 requests. Consider (j + 1)st request d = d j+1. Since S nd S FF hve greed up until now, they hve the sme cche contents before request j + 1. Cse 1: (d is lredy in the cche). S' = S stisfies invrint. Cse 2: (d is not in the cche nd S nd S FF evict the sme element). S' = S stisfies invrint. 40
41 Frthest-in-future: nlysis Pf. [continued] Cse 3: (d is not in the cche; S FF evicts e; S evicts f e). begin construction of S' from S by evicting e insted of f sme e f j sme e f S sme e d j+1 S' sme d f now S' grees with S FF on first j + 1 requests; we show tht hving element f in cche is no worse thn hving element e let S' behve the sme s S until S' is forced to tke different ction (becuse either S evicts e; or becuse either e or f is requested) 41
42 Frthest-in-future: nlysis Let j' be the first time fter j + 1 tht S' must tke different ction from S, nd let g be item requested t time j'. involves e or f (or both) sme e j' sme f S S' Cse 3: g = e. Cn't hppen with FF since there must be request for f before e. Cse 3b: g = f. Element f cn't be in cche of S, so let e' be the element tht S evicts. if e' = e, S' ccesses f from cche; now S nd S' hve sme cche if e' e, we mke S' evict e' nd brings e into the cche; now S nd S' hve the sme cche We let S' behve exctly like S for remining requests. S' is no longer reduced, but cn be trnsformed into reduced schedule tht grees with SFF through step j+1 42
43 Frthest-in-future: nlysis Let j' be the first time fter j + 1 tht S' must tke different ction from S, nd let g be item requested t time j'. involves e or f (or both) sme e j' sme f S S' otherwise S' could hve tke the sme ction Cse 3c: g e, f. S evicts e. Mke S' evict f. sme g j' sme g S S' Now S nd S' hve the sme cche. (nd we let S' behve exctly like S for the remining requests) 43
44 Cching perspective Online vs. offline lgorithms. Offline: full sequence of requests is known priori. Online (relity): requests re not known in dvnce. Cching is mong most fundmentl online problems in CS. LIFO. Evict pge brought in most recently. LRU. Evict pge whose most recent ccess ws erliest. FIF with direction of time reversed! Theorem. FF is optiml offline eviction lgorithm. Provides bsis for understnding nd nlyzing online lgorithms. LRU is k-competitive. [Section 13.8] LIFO is rbitrrily bd. 44
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 informationAlgorithm 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 informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and
More informationPreview 11/1/2017. Greedy Algorithms. Coin Change. Coin Change. Coin Change. Coin Change. Greedy algorithms. Greedy Algorithms
Preview Greed Algorithms Greed Algorithms Coin Chnge Huffmn Code Greed lgorithms end to e simple nd strightforwrd. Are often used to solve optimiztion prolems. Alws mke the choice tht looks est t the moment,
More informationCS 580: Algorithm Design and Analysis
CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Announcement: Homework 1 due soon! Due: January 25 th at midnight (Blackboard) Recap: Graphs Bipartite Graphs Definition
More information(e) if x = y + z and a divides any two of the integers x, y, or z, then a divides the remaining integer
Divisibility In this note we introduce the notion of divisibility for two integers nd b then we discuss the division lgorithm. First we give forml definition nd note some properties of the division opertion.
More informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and
More informationW. We shall do so one by one, starting with I 1, and we shall do it greedily, trying
Vitli covers 1 Definition. A Vitli cover of set E R is set V of closed intervls with positive length so tht, for every δ > 0 nd every x E, there is some I V with λ(i ) < δ nd x I. 2 Lemm (Vitli covering)
More informationDuality # Second iteration for HW problem. Recall our LP example problem we have been working on, in equality form, is given below.
Dulity #. Second itertion for HW problem Recll our LP emple problem we hve been working on, in equlity form, is given below.,,,, 8 m F which, when written in slightly different form, is 8 F Recll tht we
More informationLecture 3 ( ) (translated and slightly adapted from lecture notes by Martin Klazar)
Lecture 3 (5.3.2018) (trnslted nd slightly dpted from lecture notes by Mrtin Klzr) Riemnn integrl Now we define precisely the concept of the re, in prticulr, the re of figure U(, b, f) under the grph of
More informationp-adic Egyptian Fractions
p-adic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Set-up 3 4 p-greedy Algorithm 5 5 p-egyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction
More informationMath 61CM - Solutions to homework 9
Mth 61CM - Solutions to homework 9 Cédric De Groote November 30 th, 2018 Problem 1: Recll tht the left limit of function f t point c is defined s follows: lim f(x) = l x c if for ny > 0 there exists δ
More informationCS 188 Introduction to Artificial Intelligence Fall 2018 Note 7
CS 188 Introduction to Artificil Intelligence Fll 2018 Note 7 These lecture notes re hevily bsed on notes originlly written by Nikhil Shrm. Decision Networks In the third note, we lerned bout gme trees
More informationLecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.
Lecture 3 3 Solving liner equtions In this lecture we will discuss lgorithms for solving systems of liner equtions Multiplictive identity Let us restrict ourselves to considering squre mtrices since one
More informationCS 580: Algorithm Design and Analysis
CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Reminder: Homework 1 due tonight at 11:59PM! Recap: Greedy Algorithms Interval Scheduling Goal: Maximize number of meeting
More informationTHE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.
THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS RADON ROSBOROUGH https://intuitiveexplntionscom/picrd-lindelof-theorem/ This document is proof of the existence-uniqueness theorem
More informationLecture Note 9: Orthogonal Reduction
MATH : Computtionl Methods of Liner Algebr 1 The Row Echelon Form Lecture Note 9: Orthogonl Reduction Our trget is to solve the norml eution: Xinyi Zeng Deprtment of Mthemticl Sciences, UTEP A t Ax = A
More informationRiemann is the Mann! (But Lebesgue may besgue to differ.)
Riemnn is the Mnn! (But Lebesgue my besgue to differ.) Leo Livshits My 2, 2008 1 For finite intervls in R We hve seen in clss tht every continuous function f : [, b] R hs the property tht for every ɛ >
More informationCan the Phase I problem be unfeasible or unbounded? -No
Cn the Phse I problem be unfesible or unbounded? -No Phse I: min 1X AX + IX = b with b 0 X 1, X 0 By mnipulting constrints nd dding/subtrcting slck/surplus vribles, we cn get b 0 A fesible solution with
More informationUSA Mathematical Talent Search Round 1 Solutions Year 21 Academic Year
1/1/21. Fill in the circles in the picture t right with the digits 1-8, one digit in ech circle with no digit repeted, so tht no two circles tht re connected by line segment contin consecutive digits.
More informationFarey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University
U.U.D.M. Project Report 07:4 Frey Frctions Rickrd Fernström Exmensrete i mtemtik, 5 hp Hledre: Andres Strömergsson Exmintor: Jörgen Östensson Juni 07 Deprtment of Mthemtics Uppsl University Frey Frctions
More informationCMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)
CMSC 330: Orgniztion of Progrmming Lnguges DFAs, nd NFAs, nd Regexps (Oh my!) CMSC330 Spring 2018 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All
More informationUninformed Search Lecture 4
Lecture 4 Wht re common serch strtegies tht operte given only serch problem? How do they compre? 1 Agend A quick refresher DFS, BFS, ID-DFS, UCS Unifiction! 2 Serch Problem Formlism Defined vi the following
More information19 Optimal behavior: Game theory
Intro. to Artificil Intelligence: Dle Schuurmns, Relu Ptrscu 1 19 Optiml behvior: Gme theory Adversril stte dynmics hve to ccount for worst cse Compute policy π : S A tht mximizes minimum rewrd Let S (,
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More
More informationDATA Search I 魏忠钰. 复旦大学大数据学院 School of Data Science, Fudan University. March 7 th, 2018
DATA620006 魏忠钰 Serch I Mrch 7 th, 2018 Outline Serch Problems Uninformed Serch Depth-First Serch Bredth-First Serch Uniform-Cost Serch Rel world tsk - Pc-mn Serch problems A serch problem consists of:
More informationThe Regulated and Riemann Integrals
Chpter 1 The Regulted nd Riemnn Integrls 1.1 Introduction We will consider severl different pproches to defining the definite integrl f(x) dx of function f(x). These definitions will ll ssign the sme vlue
More informationMORE FUNCTION GRAPHING; OPTIMIZATION. (Last edited October 28, 2013 at 11:09pm.)
MORE FUNCTION GRAPHING; OPTIMIZATION FRI, OCT 25, 203 (Lst edited October 28, 203 t :09pm.) Exercise. Let n be n rbitrry positive integer. Give n exmple of function with exctly n verticl symptotes. Give
More informationCSE 417. Chapter 4: Greedy Algorithms. Many Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
CSE 417 Chapter 4: Greedy Algorithms Many Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 Greed is good. Greed is right. Greed works. Greed clarifies, cuts through,
More informationCS 188: Artificial Intelligence Spring 2007
CS 188: Artificil Intelligence Spring 2007 Lecture 3: Queue-Bsed Serch 1/23/2007 Srini Nrynn UC Berkeley Mny slides over the course dpted from Dn Klein, Sturt Russell or Andrew Moore Announcements Assignment
More informationWe will see what is meant by standard form very shortly
THEOREM: For fesible liner progrm in its stndrd form, the optimum vlue of the objective over its nonempty fesible region is () either unbounded or (b) is chievble t lest t one extreme point of the fesible
More informationConnected-components. Summary of lecture 9. Algorithms and Data Structures Disjoint sets. Example: connected components in graphs
Prm University, Mth. Deprtment Summry of lecture 9 Algorithms nd Dt Structures Disjoint sets Summry of this lecture: (CLR.1-3) Dt Structures for Disjoint sets: Union opertion Find opertion Mrco Pellegrini
More informationAdvanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004
Advnced Clculus: MATH 410 Notes on Integrls nd Integrbility Professor Dvid Levermore 17 October 2004 1. Definite Integrls In this section we revisit the definite integrl tht you were introduced to when
More informationDISCRETE MATHEMATICS HOMEWORK 3 SOLUTIONS
DISCRETE MATHEMATICS 21228 HOMEWORK 3 SOLUTIONS JC Due in clss Wednesdy September 17. You my collborte but must write up your solutions by yourself. Lte homework will not be ccepted. Homework must either
More informationMath 1B, lecture 4: Error bounds for numerical methods
Mth B, lecture 4: Error bounds for numericl methods Nthn Pflueger 4 September 0 Introduction The five numericl methods descried in the previous lecture ll operte by the sme principle: they pproximte the
More informationThis lecture covers Chapter 8 of HMU: Properties of CFLs
This lecture covers Chpter 8 of HMU: Properties of CFLs Turing Mchine Extensions of Turing Mchines Restrictions of Turing Mchines Additionl Reding: Chpter 8 of HMU. Turing Mchine: Informl Definition B
More informationIntermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4
Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one
More information1 Probability Density Functions
Lis Yn CS 9 Continuous Distributions Lecture Notes #9 July 6, 28 Bsed on chpter by Chris Piech So fr, ll rndom vribles we hve seen hve been discrete. In ll the cses we hve seen in CS 9, this ment tht our
More informationLecture 1. Functional series. Pointwise and uniform convergence.
1 Introduction. Lecture 1. Functionl series. Pointwise nd uniform convergence. In this course we study mongst other things Fourier series. The Fourier series for periodic function f(x) with period 2π is
More informationTheoretical foundations of Gaussian quadrature
Theoreticl foundtions of Gussin qudrture 1 Inner product vector spce Definition 1. A vector spce (or liner spce) is set V = {u, v, w,...} in which the following two opertions re defined: (A) Addition of
More informationMath 360: A primitive integral and elementary functions
Mth 360: A primitive integrl nd elementry functions D. DeTurck University of Pennsylvni October 16, 2017 D. DeTurck Mth 360 001 2017C: Integrl/functions 1 / 32 Setup for the integrl prtitions Definition:
More information4 7x =250; 5 3x =500; Read section 3.3, 3.4 Announcements: Bell Ringer: Use your calculator to solve
Dte: 3/14/13 Objective: SWBAT pply properties of exponentil functions nd will pply properties of rithms. Bell Ringer: Use your clcultor to solve 4 7x =250; 5 3x =500; HW Requests: Properties of Log Equtions
More informationTech. Rpt. # UMIACS-TR-99-31, Institute for Advanced Computer Studies, University of Maryland, College Park, MD 20742, June 3, 1999.
Tech. Rpt. # UMIACS-TR-99-3, Institute for Advnced Computer Studies, University of Mrylnd, College Prk, MD 20742, June 3, 999. Approximtion Algorithms nd Heuristics for the Dynmic Storge Alloction Problem
More information1 Online Learning and Regret Minimization
2.997 Decision-Mking in Lrge-Scle Systems My 10 MIT, Spring 2004 Hndout #29 Lecture Note 24 1 Online Lerning nd Regret Minimiztion In this lecture, we consider the problem of sequentil decision mking in
More informationSolution for Assignment 1 : Intro to Probability and Statistics, PAC learning
Solution for Assignment 1 : Intro to Probbility nd Sttistics, PAC lerning 10-701/15-781: Mchine Lerning (Fll 004) Due: Sept. 30th 004, Thursdy, Strt of clss Question 1. Bsic Probbility ( 18 pts) 1.1 (
More information5.7 Improper Integrals
458 pplictions of definite integrls 5.7 Improper Integrls In Section 5.4, we computed the work required to lift pylod of mss m from the surfce of moon of mss nd rdius R to height H bove the surfce of the
More informationLecture 14: Quadrature
Lecture 14: Qudrture This lecture is concerned with the evlution of integrls fx)dx 1) over finite intervl [, b] The integrnd fx) is ssumed to be rel-vlues nd smooth The pproximtion of n integrl by numericl
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic
More informationNew data structures to reduce data size and search time
New dt structures to reduce dt size nd serch time Tsuneo Kuwbr Deprtment of Informtion Sciences, Fculty of Science, Kngw University, Hirtsuk-shi, Jpn FIT2018 1D-1, No2, pp1-4 Copyright (c)2018 by The Institute
More informationA recursive construction of efficiently decodable list-disjunct matrices
CSE 709: Compressed Sensing nd Group Testing. Prt I Lecturers: Hung Q. Ngo nd Atri Rudr SUNY t Bufflo, Fll 2011 Lst updte: October 13, 2011 A recursive construction of efficiently decodble list-disjunct
More informationTypes of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt
More informationMinnesota State University, Mankato 44 th Annual High School Mathematics Contest April 12, 2017
Minnesot Stte University, Mnkto 44 th Annul High School Mthemtics Contest April, 07. A 5 ft. ldder is plced ginst verticl wll of uilding. The foot of the ldder rests on the floor nd is 7 ft. from the wll.
More informationTypes of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2
CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt
More informationMTH 505: Number Theory Spring 2017
MTH 505: Numer Theory Spring 207 Homework 2 Drew Armstrong The Froenius Coin Prolem. Consider the eqution x ` y c where,, c, x, y re nturl numers. We cn think of $ nd $ s two denomintions of coins nd $c
More informationProperties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives
Block #6: Properties of Integrls, Indefinite Integrls Gols: Definition of the Definite Integrl Integrl Clcultions using Antiderivtives Properties of Integrls The Indefinite Integrl 1 Riemnn Sums - 1 Riemnn
More informationReinforcement Learning
Reinforcement Lerning Tom Mitchell, Mchine Lerning, chpter 13 Outline Introduction Comprison with inductive lerning Mrkov Decision Processes: the model Optiml policy: The tsk Q Lerning: Q function Algorithm
More informationp(t) dt + i 1 re it ireit dt =
Note: This mteril is contined in Kreyszig, Chpter 13. Complex integrtion We will define integrls of complex functions long curves in C. (This is bit similr to [relvlued] line integrls P dx + Q dy in R2.)
More informationUNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3
UNIFORM CONVERGENCE Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3 Suppose f n : Ω R or f n : Ω C is sequence of rel or complex functions, nd f n f s n in some sense. Furthermore,
More informationFirst Midterm Examination
24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet
More informationChapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright Pearson-Addison Wesley. All rights reserved. 4 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and finishes
More informationImproper Integrals. The First Fundamental Theorem of Calculus, as we ve discussed in class, goes as follows:
Improper Integrls The First Fundmentl Theorem of Clculus, s we ve discussed in clss, goes s follows: If f is continuous on the intervl [, ] nd F is function for which F t = ft, then ftdt = F F. An integrl
More informationCMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature
CMDA 4604: Intermedite Topics in Mthemticl Modeling Lecture 19: Interpoltion nd Qudrture In this lecture we mke brief diversion into the res of interpoltion nd qudrture. Given function f C[, b], we sy
More informationConvert the NFA into DFA
Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:
More informationCMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014
CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA
More informationDesigning Information Devices and Systems I Discussion 8B
Lst Updted: 2018-10-17 19:40 1 EECS 16A Fll 2018 Designing Informtion Devices nd Systems I Discussion 8B 1. Why Bother With Thévenin Anywy? () Find Thévenin eqiuvlent for the circuit shown elow. 2kΩ 5V
More informationThe Fundamental Theorem of Calculus. The Total Change Theorem and the Area Under a Curve.
Clculus Li Vs The Fundmentl Theorem of Clculus. The Totl Chnge Theorem nd the Are Under Curve. Recll the following fct from Clculus course. If continuous function f(x) represents the rte of chnge of F
More informationTests for the Ratio of Two Poisson Rates
Chpter 437 Tests for the Rtio of Two Poisson Rtes Introduction The Poisson probbility lw gives the probbility distribution of the number of events occurring in specified intervl of time or spce. The Poisson
More informationRead section 3.3, 3.4 Announcements:
Dte: 3/1/13 Objective: SWBAT pply properties of exponentil functions nd will pply properties of rithms. Bell Ringer: 1. f x = 3x 6, find the inverse, f 1 x., Using your grphing clcultor, Grph 1. f x,f
More informationAcceptance Sampling by Attributes
Introduction Acceptnce Smpling by Attributes Acceptnce smpling is concerned with inspection nd decision mking regrding products. Three spects of smpling re importnt: o Involves rndom smpling of n entire
More informationProperties of the Riemann Integral
Properties of the Riemnn Integrl Jmes K. Peterson Deprtment of Biologicl Sciences nd Deprtment of Mthemticl Sciences Clemson University Februry 15, 2018 Outline 1 Some Infimum nd Supremum Properties 2
More informationMath 270A: Numerical Linear Algebra
Mth 70A: Numericl Liner Algebr Instructor: Michel Holst Fll Qurter 014 Homework Assignment #3 Due Give to TA t lest few dys before finl if you wnt feedbck. Exercise 3.1. (The Bsic Liner Method for Liner
More informationQuadratic Forms. Quadratic Forms
Qudrtic Forms Recll the Simon & Blume excerpt from n erlier lecture which sid tht the min tsk of clculus is to pproximte nonliner functions with liner functions. It s ctully more ccurte to sy tht we pproximte
More informationState space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies
Stte spce systems nlysis (continued) Stbility A. Definitions A system is sid to be Asymptoticlly Stble (AS) when it stisfies ut () = 0, t > 0 lim xt () 0. t A system is AS if nd only if the impulse response
More informationState Minimization for DFAs
Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid
More informationReview of Gaussian Quadrature method
Review of Gussin Qudrture method Nsser M. Asi Spring 006 compiled on Sundy Decemer 1, 017 t 09:1 PM 1 The prolem To find numericl vlue for the integrl of rel vlued function of rel vrile over specific rnge
More informationFirst Midterm Examination
Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does
More informationapproaches as n becomes larger and larger. Since e > 1, the graph of the natural exponential function is as below
. Eponentil nd rithmic functions.1 Eponentil Functions A function of the form f() =, > 0, 1 is clled n eponentil function. Its domin is the set of ll rel f ( 1) numbers. For n eponentil function f we hve.
More informationMath 1431 Section M TH 4:00 PM 6:00 PM Susan Wheeler Office Hours: Wed 6:00 7:00 PM Online ***NOTE LABS ARE MON AND WED
Mth 43 Section 4839 M TH 4: PM 6: PM Susn Wheeler swheeler@mth.uh.edu Office Hours: Wed 6: 7: PM Online ***NOTE LABS ARE MON AND WED t :3 PM to 3: pm ONLINE Approimting the re under curve given the type
More informationReinforcement learning II
CS 1675 Introduction to Mchine Lerning Lecture 26 Reinforcement lerning II Milos Huskrecht milos@cs.pitt.edu 5329 Sennott Squre Reinforcement lerning Bsics: Input x Lerner Output Reinforcement r Critic
More informationRiemann Sums and Riemann Integrals
Riemnn Sums nd Riemnn Integrls Jmes K. Peterson Deprtment of Biologicl Sciences nd Deprtment of Mthemticl Sciences Clemson University August 26, 2013 Outline 1 Riemnn Sums 2 Riemnn Integrls 3 Properties
More informationAPPROXIMATE INTEGRATION
APPROXIMATE INTEGRATION. Introduction We hve seen tht there re functions whose nti-derivtives cnnot be expressed in closed form. For these resons ny definite integrl involving these integrnds cnnot be
More informationThe steps of the hypothesis test
ttisticl Methods I (EXT 7005) Pge 78 Mosquito species Time of dy A B C Mid morning 0.0088 5.4900 5.5000 Mid Afternoon.3400 0.0300 0.8700 Dusk 0.600 5.400 3.000 The Chi squre test sttistic is the sum of
More informationUnit #9 : Definite Integral Properties; Fundamental Theorem of Calculus
Unit #9 : Definite Integrl Properties; Fundmentl Theorem of Clculus Gols: Identify properties of definite integrls Define odd nd even functions, nd reltionship to integrl vlues Introduce the Fundmentl
More informationDesigning Information Devices and Systems I Spring 2018 Homework 7
EECS 16A Designing Informtion Devices nd Systems I Spring 2018 omework 7 This homework is due Mrch 12, 2018, t 23:59. Self-grdes re due Mrch 15, 2018, t 23:59. Sumission Formt Your homework sumission should
More informationRiemann Sums and Riemann Integrals
Riemnn Sums nd Riemnn Integrls Jmes K. Peterson Deprtment of Biologicl Sciences nd Deprtment of Mthemticl Sciences Clemson University August 26, 203 Outline Riemnn Sums Riemnn Integrls Properties Abstrct
More informationfractions Let s Learn to
5 simple lgebric frctions corne lens pupil retin Norml vision light focused on the retin concve lens Shortsightedness (myopi) light focused in front of the retin Corrected myopi light focused on the retin
More informationMatrix Solution to Linear Equations and Markov Chains
Trding Systems nd Methods, Fifth Edition By Perry J. Kufmn Copyright 2005, 2013 by Perry J. Kufmn APPENDIX 2 Mtrix Solution to Liner Equtions nd Mrkov Chins DIRECT SOLUTION AND CONVERGENCE METHOD Before
More informationThe Henstock-Kurzweil integral
fculteit Wiskunde en Ntuurwetenschppen The Henstock-Kurzweil integrl Bchelorthesis Mthemtics June 2014 Student: E. vn Dijk First supervisor: Dr. A.E. Sterk Second supervisor: Prof. dr. A. vn der Schft
More informationAdministrivia CSE 190: Reinforcement Learning: An Introduction
Administrivi CSE 190: Reinforcement Lerning: An Introduction Any emil sent to me bout the course should hve CSE 190 in the subject line! Chpter 4: Dynmic Progrmming Acknowledgment: A good number of these
More informationVyacheslav Telnin. Search for New Numbers.
Vycheslv Telnin Serch for New Numbers. 1 CHAPTER I 2 I.1 Introduction. In 1984, in the first issue for tht yer of the Science nd Life mgzine, I red the rticle "Non-Stndrd Anlysis" by V. Uspensky, in which
More informationHow do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?
XII. LINEAR ALGEBRA: SOLVING SYSTEMS OF EQUATIONS Tody we re going to tlk out solving systems of liner equtions. These re prolems tht give couple of equtions with couple of unknowns, like: 6= x + x 7=
More informationChapter 14. Matrix Representations of Linear Transformations
Chpter 4 Mtrix Representtions of Liner Trnsformtions When considering the Het Stte Evolution, we found tht we could describe this process using multipliction by mtrix. This ws nice becuse computers cn
More informationReview of Calculus, cont d
Jim Lmbers MAT 460 Fll Semester 2009-10 Lecture 3 Notes These notes correspond to Section 1.1 in the text. Review of Clculus, cont d Riemnn Sums nd the Definite Integrl There re mny cses in which some
More informationHomework 3 Solutions
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.
More informationFinite Automata-cont d
Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww
More informationNondeterminism and Nodeterministic Automata
Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely
More informationThe area under the graph of f and above the x-axis between a and b is denoted by. f(x) dx. π O
1 Section 5. The Definite Integrl Suppose tht function f is continuous nd positive over n intervl [, ]. y = f(x) x The re under the grph of f nd ove the x-xis etween nd is denoted y f(x) dx nd clled the
More informationProblem Set 9. Figure 1: Diagram. This picture is a rough sketch of the 4 parabolas that give us the area that we need to find. The equations are:
(x + y ) = y + (x + y ) = x + Problem Set 9 Discussion: Nov., Nov. 8, Nov. (on probbility nd binomil coefficients) The nme fter the problem is the designted writer of the solution of tht problem. (No one
More informationBases for Vector Spaces
Bses for Vector Spces 2-26-25 A set is independent if, roughly speking, there is no redundncy in the set: You cn t uild ny vector in the set s liner comintion of the others A set spns if you cn uild everything
More informationPART 1 MULTIPLE CHOICE Circle the appropriate response to each of the questions below. Each question has a value of 1 point.
PART MULTIPLE CHOICE Circle the pproprite response to ech of the questions below. Ech question hs vlue of point.. If in sequence the second level difference is constnt, thn the sequence is:. rithmetic
More information