Greedy Algorithms Spanning Trees
|
|
- Frederick Williams
- 5 years ago
- Views:
Transcription
1 Greedy Algoritms Spnning Trees Cpter 1, Wt mkes greedy lgoritm? Fesible Hs to stisfy te problem s constrints Loclly Optiml Te greedy prt Hs to mke te best locl coice mong ll fesible coices vilble on tt step If tis locl coice results in globl optimum ten te problem s optiml substructure Irrevocble Once coice is mde it cn t be un-done on subsequent steps of te lgoritm Simple exmples: Plying cess by mking best move witout looked Giving fewest number of coins s cnge Simple nd ppeling, but don t lwys give te best solution 1
2 Activity Selection Problem Problem: Scedule n exclusive resource in competition wit oter entities. For exmple, sceduling te use of room (only one entity cn use it t time) wen severl groups wnt to use it. Or, renting out some piece of equipment to different people. Definition: Set S={1,, n} of ctivities. Ec ctivity s strt time s i nd finis time f j, were s i <f j. Activities i nd j re comptible if tey do not overlp. Te ctivity selection problem is to select mximum-size set of mutully comptible ctivities. Greedy Activity Selection Just mrc troug ec ctivity by finis time nd scedule it if possible:
3 Activity Selection Exmple Scedule job 1, ten try rest: (end up wit 1,, ): T=1 T= T= T= T= T= T=7 T= T= T= T=11 T=1 T= Runtime? Greedy vs. Dynmic? Greedy lgoritms nd dynmic progrmming re similr; bot generlly work under te sme circumstnces ltoug dynmic progrmming solves subproblems first. Often bot my be used to solve problem ltoug tis is not lwys te cse. Consider te 0-1 knpsck problem. A tief is robbing store tt s items 1..n. Ec item is wort v[i] dollrs nd weigs w[i] pounds. Te tief wnts to tke te most mount of loot but is knpsck cn only old weigt W. Wt items sould e tke? Greedy lgoritm: Tke s muc of te most vluble item first. Does not necessrily give optiml vlue!
4 Frctionl Knpsck Problem Consider te frctionl knpsck problem. Tis time te tief cn tke ny frction of te objects. For exmple, te gold my be gold dust insted of gold brs. In tis cse, it will beoove te tief to tke s muc of te most vluble item per weigt (vlue/weigt) e cn crry, ten s muc of te next vluble item, until e cn crry no more weigt. Morl Greedy lgoritm sometimes gives te optiml solution, sometimes not, depending on te problem. Dynmic progrmming, wen pplicble, will typiclly give optiml solutions, but re usully trickier to come up wit nd sometimes trickier to implement. Definition Spnning Tree A spnning tree of grp G is tree (cyclic) tt connects ll te vertices of G once i.e. te tree spns every vertex in G A Minimum Spnning Tree (MST) is spnning tree on weigted grp tt s te minimum totl weigt w( T ) = w( u, v) suc tt w(t) is minimum u, v T Were migt tis be useful? Cn lso be used to pproximte some NP-Complete problems
5 Smple MST Wic links to mke tis MST? 1 Optiml substructure: A subtree of te MST must in turn be MST of te nodes tt it spns. MST Clim Clim: Sy tt M is MST If we remove ny edge (u,v) from M ten tis results in two trees, T1 nd T. T1 is MST of its subgrp wile T is MST of its subgrp. Ten te MST of te entire grp is T1 + T + te smllest edge between T1 nd T If some oter edge ws used, we wouldn t ve te minimum spnning tree overll
6 Greedy Algoritm We cn use greedy lgoritm to find te MST. Two common lgoritms Kruskl Prim Kruskl s MST Algoritm Ide: Greedily construct te MST Go troug te list of edges nd mke forest tt is MST At ec vertex, sort te edges Edges wit smllest weigts exmined nd possibly dded to MST before edges wit iger weigts Edges dded must be sfe edges tt do not ruin te tree property.
7 Kruskl s Algoritm Kruskl(G,w) ; Grp G, wit weigts w A {} ; Our MST strts empty for ec vertex v V [ G] do Mke-Set(v) ; Mke ec vertex set Sort edges of E by incresing weigt for ec edge ( u, v) E in order ; Find-Set returns representtive (first vertex) in te set do if Find-Set(u) Find-Set(v) ten A A {( u, v )} Union(u,v) ; Combines two trees return A Kruskl s Exmple 1 A={ }, Mke ec element its own set. {} {b} {c} {d} {e} {f} {g} {} Sort edges. Look t smllest edge first: {c} nd {f} not in sme set, dd it to A, union togeter. Now get {} {b} {c f} {d} {e} {g} {} 7
8 Kruskl Exmple Keep going, cecking next smllest edge. Hd: {} {b} {c f} {d} {e} {g} {} {e} {}, dd edge. 1 Now get {} {b} {c f} {d} {e } {g} Keep going, cecking next smllest edge. Hd: {} {b} {c f} {d} {e } {g} {} {c f}, dd edge. Kruskl Exmple 1 Now get {b} { c f} {d} {e } {g}
9 Kruskl s Exmple Keep going, cecking next smllest edge. Hd {b} { c f} {d} {e } {g} {b} { c f}, dd edge. 1 Now get { b c f} {d} {e } {g} Kruskl s Exmple Keep going, cecking next smllest edge. Hd { b c f} {d} {e } {g} { b c f} = { b c f}, dont dd it! 1
10 Kruskl s Exmple Keep going, cecking next smllest edge. Hd { b c f} {d} {e } {g} { b c f} = {e }, dd it. 1 Now get { b c f e } {d}{g} Kruskl s Exmple Keep going, cecking next smllest edge. Hd { b c f e } {d}{g} {d} { b c e f }, dd it. 1 Now get { e f } {g}
11 Kruskl s Exmple Keep going, ceck next two smllest edges. Hd { e f } {g} { e f } = { e f }, don t dd it. 1 Kruskl s Exmple Do dd te lst one: Hd { e f } {g} 1 11
12 Runtime of Kruskl s Algo Runtime depends upon time to union set, find set, mke set Simple set implementtion: number ec vertex nd use n rry Use n rry member[] : member[i] is number j suc tt te it vertex is member of te jt set. Exmple member[1,,1,,] indictes te sets S1={1,}, S={,} nd S={}; i.e. position in te rry gives te set number. Ide similr to counting sort, up to number of edge members. Given te Member rry Set Opertions 1 Mke-Set(v) member[v] = v member = [1,,] ; {1} {} {} Mke-Set runs in constnt running time for single set. Find-Set(v) Return member[v] Find-Set runs in constnt time. Union(u,v) for i=1 to n do if member[i] = u ten member[i]=v find-set() = Union(,) member = [1,,] ; {1} { } Scn troug te member rry nd updte old members to be te new set. Running time O(n), lengt of member rry. 1
13 Overll Runtime Kruskl(G,w) ; Grp G, wit weigts w O(V) A {} ; Our MST strts empty for ec vertex v V [ G] do Mke-Set(v) ; Mke ec vertex set Sort edges of E by incresing weigt O(ElgE) using epsort for ec edge ( u, v) E in order O(E) ; Find-Set returns representtive (first vertex) in te set do if Find-Set(u) Find-Set(v) O(1) ten A A {( u, v )} Union(u,v) ; Combines two trees return A O(V) Totl runtime: O(V)+O(ElgE)+O(E*(1+V)) = O(E*V) Book describes version using disjoint sets tt runs in O(E*lgE) time Prim s MST Algoritm Also greedy, like Kruskl s Will find MST but my differ from Prim s if multiple MST s re possible MST-Prim(G,w,r) ; Grp G, weigts w, root r Q V[G] for ec vertex u Q do key[u] ; inite distnce key[r] 0 P[r] NIL wile Q<>NIL do u Extrct-Min(Q) ; remove closest node ; Updte cildren of u so tey ve prent nd min key vl ; te key is te weigt between node nd prent for ec v Adj[u] do if v Q & w(u,v)<key[v] ten P[v] u key[v] w(u,v) 1
14 Prim s Exmple Exmple: Grp given erlier. Q={ (e,0) (, ) (b, ) (c, ) (d, ) (f, ) (g, ) (, ) } 1 0/nil Extrct min, vertex e. Updte neigbor if in Q nd weigt < key. Prim s Exmple 1/e 1 0/nil /e Q={ (, ) (b,1) (c, ) (d, ) (f, ) (g, ) (,) } Extrct min, vertex. Updte neigbor if in Q nd weigt < key 1
15 Prim s Algoritm / 1 0/nil / /e Q={ (, ) (b,) (c, ) (d, ) (f,) (g, ) } Extrct min, vertex f. Updte neigbor if in Q nd weigt < key Prim s Algoritm / /f 1 /f 0/nil / /e Q={ (, ) (b,) (c, ) (d, ) (g,) } Extrct min, vertex c. Updte neigbor if in Q nd weigt < key
16 Prim s Algoritm /c /c /f /c 1 /f 0/nil / /e Q={ (,) (b,) (d,) (g,) } Extrct min, vertex. No keys re smller tn edges from (> on edge c, > on edge b) so noting done. Q={ (b,) (d,) (g,) } Extrct min, vertex b. Sme cse, no keys re smller tn edges, so noting is done. Sme for extrcting d nd g, nd we re done. Prim s Algoritm Get spnning tree by connecting nodes wit teir prents: /c /c /f /c 1 /f 0/nil / /e 1
17 O(V) Runtime for Prim s Algoritm MST-Prim(G,w,r) ; Grp G, weigts w, root r Q V[G] for ec vertex u Q do key[u] ; inite distnce key[r] 0 P[r] NIL wile Q<>NIL do u Extrct-Min(Q) ; remove closest node ; Updte cildren of u so tey ve prent nd min key vl ; te key is te weigt between node nd prent for ec v Adj[u] do if v Q & w(u,v)<key[v] ten P[v] u key[v] w(u,v) O(V) if using ep O(lgV) if using ep O(E) over entire wile(q<>nil) loop O(lgV) to updte if using ep! Te inner loop tkes O(E lg V) for te ep updte inside te O(E) loop. Tis is over ll executions, so it is not multiplied by O(V) for te wile loop (tis is included in te O(E) runtime troug ll edges. Te Extrct-Min requires O(V lg V) time. O(lg V) for te Extrct-Min nd O(V) for te wile loop. Totl runtime is ten O(V lg V) + O(E lg V) wic is O(E lg V) in connected grp ( connected grp will lwys ve t lest V-1 edges). Prim s Algoritm Liner Arry for Q Wt if we use simple liner rry for te queue insted of ep? Use te index s te vertex number Contents of rry s te distnce vlue E.g. Vl[ ] Pr[ 7 ] Sys tt vertex 1 s key =, vertex s key =, etc. Use specil vlue for inity or if vertex removed from te queue Sys tt vertex 1 s prent node, vertex s prent node, etc. Building Queue: O(n) time to crete rrys Extrct min: O(n) time to scn troug te rry Updte key: O(1) time 17
18 O(V) Runtime for Prim s Algoritm wit Queue s Arry MST-Prim(G,w,r) ; Grp G, weigts w, root r Q V[G] for ec vertex u Q do key[u] ; inite distnce key[r] 0 P[r] NIL wile Q<>NIL do u Extrct-Min(Q) ; remove closest node ; Updte cildren of u so tey ve prent nd min key vl ; te key is te weigt between node nd prent for ec v Adj[u] do if v Q & w(u,v)<key[v] ten P[v] u key[v] w(u,v) Te inner loop tkes O(E ) over ll itertions of te outer loop. It is not multiplied by O(V) for te wile loop. Te Extrct-Min requires O(V ) time. Tis is O(V ) over te wile loop. Totl runtime is ten O(V ) + O(E) wic is O(V ) Using ep our runtime ws O(E lg V). Wic is worse? Wic is worse for fully connected grp? O(V) to initilize rry O(V) to serc rry O(E) over entire wile(q<>nil) loop O(1) direct ccess vi rry index Approximtions for Hrd Problems Greedy lgoritms re commonly used to find pproximtions for NP-Complete problems Use euristic to drive te greedy selection Heuristic: A common-sense rule tt pproximtes moves towrd te optiml solution If our problem is to minimize function f were f(s*) is te vlue of te exct solution; globl minimum f(s ) is te vlue of our pproximte solution Ten we wnt to minimize te rtio: f(s ) / f(s*) suc tt tis pproces 1 Opposite if mximizing function 1
19 Exmple: Trveling Slesmn Problem Cep greedy solution to te TSP: Coose n rbitrry city s te strt Visit te nerest unvisited city; repet until ll cities ve been visited Return to te strting city Exmple grp: 1 b Strting t : ->b->c->d-> Totl = Optiml: ->b->d->c-> d 1 c r(s ) = / = 1. Is tis good pproc? Wt if ->d =? Greedy TSP Our greedy pproc is not so bd if te grp deres to Eucliden geometry Tringle inequlity d[i,j] d[i,k] + d[k,j] for ny triple cities i,j,k Symmetry d[i,j] = d[j,i] for ny pir of cities i,j In our previous exmple, we couldn t ve one-wy edge to city of were ll te oter edges re smller (if city is fr wy, forced to visit it some wy) It s been proven for Eucliden instnces te nerest neigbor lgoritm: f(s ) / f(s*) (lg n + 1) / n cities 1
20 Minimum Spnning Tree Approximtion We cn use MST to get better pproximtion to te TSP problem Tis is clled twice-round-te-tree lgoritm We construct MST nd fix it up so tt it mkes vlid tour Construct MST of te grp corresponding to te TSP problem Strting t n rbitrry vertex, perform DFS wlk round te MST recording te vertices pssed by Scn te list of vertices from te previous step nd eliminte ll repet occurrences except te strting one. Te vertices remining will form Hmiltonin circuit tt is te output of te lgoritm. MST Approximtion to TSP Exmple grp: 1 e 7 e 7 b d b d 1 c 1 c MST: b, bc, bd, de Wlk:, b, c, b, d, e, d, b,, b, c, d, e, 0
21 MST Approximtion Runtime: polynomil (Kruskl/Prim) Clim: f(s ) < f(s*) Lengt of te pproximtion solutuion t most twice te lengt of te optiml Since removing ny edge from s* yields spnning tree T of weigt w(t) tt must be w(t*), te weigt of te grp s MST, we ve: f(s*) > w(t) w(t*) f(s*) > w(t*) Te wlk of te MST tree we used to generte te pproximte solution trversed te MST t most twice, so: w(t*) > f(s ) Giving: f(s*) > w(t*) > f(s ) f(s*) > f(s ) 1
Problem Final Exam Set 2 Solutions
CSE 5 5 Algoritms nd nd Progrms Prolem Finl Exm Set Solutions Jontn Turner Exm - //05 0/8/0. (5 points) Suppose you re implementing grp lgoritm tt uses ep s one of its primry dt strutures. Te lgoritm does
More informationCS201 Discussion 10 DRAWTREE + TRIES
CS201 Discussion 10 DRAWTREE + TRIES DrwTree First instinct: recursion As very generic structure, we could tckle this problem s follows: drw(): Find the root drw(root) drw(root): Write the line for the
More informationChapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.
Chpter 9 Greey Tehnique Copyright 2007 Person Aison-Wesley. All rights reserve. Greey Tehnique Construts solution to n optimiztion prolem piee y piee through sequene of hoies tht re: fesile lolly optiml
More informationGreedy Algorithms. At each step in the algorithm, one of several choices can be made.
Greedy Algorithms At each step in the algorithm, one of several choices can be made. Greedy Strategy: make the choice that is the best at the moment. After making a choice, we are left with one subproblem
More informationLecture Notes for Chapter 23: Minimum Spanning Trees
Lecture Notes for Chapter 23: Minimum Spanning Trees Chapter 23 overview Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has
More informationMinimum Spanning Trees
Minimum Spanning Trees 1 Minimum- Spanning Trees 1. Concrete example: computer connection. Definition of a Minimum- Spanning Tree Concrete example Imagine: You wish to connect all the computers in an office
More information4452 Mathematical Modeling Lecture 4: Lagrange Multipliers
Mth Modeling Lecture 4: Lgrnge Multipliers Pge 4452 Mthemticl Modeling Lecture 4: Lgrnge Multipliers Lgrnge multipliers re high powered mthemticl technique to find the mximum nd minimum of multidimensionl
More informationRight Triangle Trigonometry
Rigt Tringle Trigonometry Trigonometry comes from te Greek trigon (tringle) nd metron (mesure) nd is te study of te reltion between side lengts nd ngles of tringles. Angles A ry is strigt lf line tt stretces
More informationGreedy Algorithm. Algorithm Fall Semester
Greey Algorithm Algorithm 0 Fll Semester Optimiztion prolems An optimiztion prolem is one in whih you wnt to fin, not just solution, ut the est solution A greey lgorithm sometimes works well for optimiztion
More informationMinimum Spanning Trees Ch 23 Traversing graphs
Next: Graph Algorithms Graphs Ch 22 Graph representations adjacency list adjacency matrix Minimum Spanning Trees Ch 23 Traversing graphs Breadth-First Search Depth-First Search 11/30/17 CSE 3101 1 Graphs
More informationSlides for Data Mining by I. H. Witten and E. Frank
Slides for Dt Mining y I. H. Witten nd E. Frnk Simplicity first Simple lgorithms often work very well! There re mny kinds of simple structure, eg: One ttriute does ll the work All ttriutes contriute eqully
More informationDynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012
Dynmic Progrmming Andres Klppenecker [prtilly bsed on slides by Prof. Welch] 1 Dynmic Progrmming Optiml substructure An optiml solution to the problem contins within it optiml solutions to subproblems.
More information2pt 0em. Computer Science & Engineering 423/823 Design and Analysis of Algorithms. Lecture 04 Minimum-Weight Spanning Trees (Chapter 23)
2pt 0em Computer Science & Engineering 423/823 Design and of s Lecture 04 Minimum-Weight Spanning Trees (Chapter 23) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 18 Given a connected, undirected
More informationMinimum Spanning Trees
Chapter 23 Minimum Spanning Trees Let G(V, E, ω) be a weighted connected graph. Find out another weighted connected graph T(V, E, ω), E E, such that T has the minimum weight among all such T s. An important
More information10.5 Graphing Quadratic Functions
0.5 Grphing Qudrtic Functions Now tht we cn solve qudrtic equtions, we wnt to lern how to grph the function ssocited with the qudrtic eqution. We cll this the qudrtic function. Grphs of Qudrtic Functions
More informationCS311H: Discrete Mathematics. Graph Theory IV. A Non-planar Graph. Regions of a Planar Graph. Euler s Formula. Instructor: Işıl Dillig
CS311H: Discrete Mthemtics Grph Theory IV Instructor: Işıl Dillig Instructor: Işıl Dillig, CS311H: Discrete Mthemtics Grph Theory IV 1/25 A Non-plnr Grph Regions of Plnr Grph The plnr representtion of
More information2 Computing all Intersections of a Set of Segments Line Segment Intersection
15-451/651: Design & Anlysis of Algorithms Novemer 14, 2016 Lecture #21 Sweep-Line nd Segment Intersection lst chnged: Novemer 8, 2017 1 Preliminries The sweep-line prdigm is very powerful lgorithmic design
More informationIn the last lecture, we discussed how valid tokens may be specified by regular expressions.
LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.
More informationP(r)dr = probability of generating a random number in the interval dr near r. For this probability idea to make sense we must have
Rndom Numers nd Monte Crlo Methods Rndom Numer Methods The integrtion methods discussed so fr ll re sed upon mking polynomil pproximtions to the integrnd. Another clss of numericl methods relies upon using
More informationIf you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs.
Lecture 5 Wlks, Trils, Pths nd Connectedness Reding: Some of the mteril in this lecture comes from Section 1.2 of Dieter Jungnickel (2008), Grphs, Networks nd Algorithms, 3rd edition, which is ville online
More informationCOMP 423 lecture 11 Jan. 28, 2008
COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring
More informationCS 188: Artificial Intelligence Fall 2008
CS 188: Artificil Intelligence Fll 2008 Lecture 2: Queue-Bsed Serc 9/2/2008 Dn Klein UC Berkeley Mny slides from eiter Sturt Russell or Andrew Moore Announcements Written ssignments: One mini-omework ec
More informationCSCI1950 Z Computa4onal Methods for Biology Lecture 2. Ben Raphael January 26, hhp://cs.brown.edu/courses/csci1950 z/ Outline
CSCI1950 Z Comput4onl Methods for Biology Lecture 2 Ben Rphel Jnury 26, 2009 hhp://cs.brown.edu/courses/csci1950 z/ Outline Review of trees. Coun4ng fetures. Chrcter bsed phylogeny Mximum prsimony Mximum
More informationMA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork
MA1008 Clculus nd Liner Algebr for Engineers Course Notes for Section B Stephen Wills Deprtment of Mthemtics University College Cork s.wills@ucc.ie http://euclid.ucc.ie/pges/stff/wills/teching/m1008/ma1008.html
More informationMATH 25 CLASS 5 NOTES, SEP
MATH 25 CLASS 5 NOTES, SEP 30 2011 Contents 1. A brief diversion: reltively prime numbers 1 2. Lest common multiples 3 3. Finding ll solutions to x + by = c 4 Quick links to definitions/theorems Euclid
More informationIntegration. September 28, 2017
Integrtion September 8, 7 Introduction We hve lerned in previous chpter on how to do the differentition. It is conventionl in mthemtics tht we re supposed to lern bout the integrtion s well. As you my
More information1 Start with each vertex being its own component. 2 Merge two components into one by choosing the light edge
Taking Stock IE170: in Systems Engineering: Lecture 19 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 16, 2007 Last Time Minimum This Time More Strongly Connected
More informationThe Greedy Method. The Greedy Method
Lists nd Itertors /8/26 Presenttion for use with the textook, Algorithm Design nd Applictions, y M. T. Goodrich nd R. Tmssi, Wiley, 25 The Greedy Method The Greedy Method The greedy method is generl lgorithm
More informationPointwise convergence need not behave well with respect to standard properties such as continuity.
Chpter 3 Uniform Convergence Lecture 9 Sequences of functions re of gret importnce in mny res of pure nd pplied mthemtics, nd their properties cn often be studied in the context of metric spces, s in Exmples
More informationSolving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Winter 2016
Solving Prolems y Serching CS 486/686: Introduction to Artificil Intelligence Winter 2016 1 Introduction Serch ws one of the first topics studied in AI - Newell nd Simon (1961) Generl Prolem Solver Centrl
More informationCSEP 573 Artificial Intelligence Winter 2016
CSEP 573 Artificil Intelligence Winter 2016 Luke Zettlemoyer Problem Spces nd Serch slides from Dn Klein, Sturt Russell, Andrew Moore, Dn Weld, Pieter Abbeel, Ali Frhdi Outline Agents tht Pln Ahed Serch
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 05 Minimum-Weight Spanning Trees (Chapter 23) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu Introduction
More information12-B FRACTIONS AND DECIMALS
-B Frctions nd Decimls. () If ll four integers were negtive, their product would be positive, nd so could not equl one of them. If ll four integers were positive, their product would be much greter thn
More informationComplete Coverage Path Planning of Mobile Robot Based on Dynamic Programming Algorithm Peng Zhou, Zhong-min Wang, Zhen-nan Li, Yang Li
2nd Interntionl Conference on Electronic & Mechnicl Engineering nd Informtion Technology (EMEIT-212) Complete Coverge Pth Plnning of Mobile Robot Bsed on Dynmic Progrmming Algorithm Peng Zhou, Zhong-min
More informationSAMPLE PREREQUISITE PROBLEMS: CALCULUS
SAMPLE PREREQUISITE PROBLEMS: CALCULUS Te following questions rise from ctul AP Clculus AB em questions; I went troug lots of questions, nd pulled out prts requiring lgebr nd trigonometr Tese problems
More informationToday. CS 188: Artificial Intelligence Fall Recap: Search. Example: Pancake Problem. Example: Pancake Problem. General Tree Search.
CS 88: Artificil Intelligence Fll 00 Lecture : A* Serch 9//00 A* Serch rph Serch Tody Heuristic Design Dn Klein UC Berkeley Multiple slides from Sturt Russell or Andrew Moore Recp: Serch Exmple: Pncke
More information9.3 Warmup Find the value of x and y
9.3 Wrmup Find te vlue of x nd y. 1. 2. 3. 4 x 10 4. 5. x 36 6. Are tese te sides of tringle? If yes, is te cute, otuse or rigt?. 4, 4, 10 Mrc 3, 2017 y Geometry 9.1 Similr Rigt Tringles. 9, 15,12 c. 2,
More informationRepresentation of Numbers. Number Representation. Representation of Numbers. 32-bit Unsigned Integers 3/24/2014. Fixed point Integer Representation
Representtion of Numbers Number Representtion Computer represent ll numbers, other thn integers nd some frctions with imprecision. Numbers re stored in some pproximtion which cn be represented by fixed
More information50 AMC LECTURES Lecture 2 Analytic Geometry Distance and Lines. can be calculated by the following formula:
5 AMC LECTURES Lecture Anlytic Geometry Distnce nd Lines BASIC KNOWLEDGE. Distnce formul The distnce (d) between two points P ( x, y) nd P ( x, y) cn be clculted by the following formul: d ( x y () x )
More informationINTRODUCTION TO SIMPLICIAL COMPLEXES
INTRODUCTION TO SIMPLICIAL COMPLEXES CASEY KELLEHER AND ALESSANDRA PANTANO 0.1. Introduction. In this ctivity set we re going to introduce notion from Algebric Topology clled simplicil homology. The min
More informationAnnouncements. CS 188: Artificial Intelligence Fall Recap: Search. Today. General Tree Search. Uniform Cost. Lecture 3: A* Search 9/4/2007
CS 88: Artificil Intelligence Fll 2007 Lecture : A* Serch 9/4/2007 Dn Klein UC Berkeley Mny slides over the course dpted from either Sturt Russell or Andrew Moore Announcements Sections: New section 06:
More informationG205 Fundamentals of Computer Engineering. CLASS 21, Mon. Nov Stefano Basagni Fall 2004 M-W, 1:30pm-3:10pm
G205 Fundamentals of Computer Engineering CLASS 21, Mon. Nov. 22 2004 Stefano Basagni Fall 2004 M-W, 1:30pm-3:10pm Greedy Algorithms, 1 Algorithms for Optimization Problems Sequence of steps Choices at
More informationSection 3.1: Sequences and Series
Section.: Sequences d Series Sequences Let s strt out with the definition of sequence: sequence: ordered list of numbers, often with definite pttern Recll tht in set, order doesn t mtter so this is one
More informationToday. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search
Uninformed Serch [These slides were creted by Dn Klein nd Pieter Abbeel for CS188 Intro to AI t UC Berkeley. All CS188 mterils re vilble t http://i.berkeley.edu.] Tody Serch Problems Uninformed Serch Methods
More informationCSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe
CSCI 0 fel Ferreir d Silv rfsilv@isi.edu Slides dpted from: Mrk edekopp nd Dvid Kempe LOG STUCTUED MEGE TEES Series Summtion eview Let n = + + + + k $ = #%& #. Wht is n? n = k+ - Wht is log () + log ()
More informationWhat are suffix trees?
Suffix Trees 1 Wht re suffix trees? Allow lgorithm designers to store very lrge mount of informtion out strings while still keeping within liner spce Allow users to serch for new strings in the originl
More informationUnit 2: Algorithmic Graph Theory
Unit 2: Algorithmic Graph Theory Course contents: Introduction to graph theory Basic graph algorithms Reading Chapter 3 Reference: Cormen, Leiserson, and Rivest, Introduction to Algorithms, 2 nd Ed., McGraw
More informationCOP 4531 Complexity & Analysis of Data Structures & Algorithms
COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 9 Minimum Spanning Trees Thanks to the text authors who contributed to these slides Why Minimum Spanning Trees (MST)? Example 1 A
More informationSolving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence
Solving Prolems y Serching CS 486/686: Introduction to Artificil Intelligence 1 Introduction Serch ws one of the first topics studied in AI - Newell nd Simon (1961) Generl Prolem Solver Centrl component
More informationUnion-Find Problem. Using Arrays And Chains. A Set As A Tree. Result Of A Find Operation
Union-Find Problem Given set {,,, n} of n elements. Initilly ech element is in different set. ƒ {}, {},, {n} An intermixed sequence of union nd find opertions is performed. A union opertion combines two
More informationGraphs with at most two trees in a forest building process
Grphs with t most two trees in forest uilding process rxiv:802.0533v [mth.co] 4 Fe 208 Steve Butler Mis Hmnk Mrie Hrdt Astrct Given grph, we cn form spnning forest y first sorting the edges in some order,
More information1. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES)
Numbers nd Opertions, Algebr, nd Functions 45. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES) In sequence of terms involving eponentil growth, which the testing service lso clls geometric
More informationMATH 2530: WORKSHEET 7. x 2 y dz dy dx =
MATH 253: WORKSHT 7 () Wrm-up: () Review: polr coordintes, integrls involving polr coordintes, triple Riemnn sums, triple integrls, the pplictions of triple integrls (especilly to volume), nd cylindricl
More informationZZ - Advanced Math Review 2017
ZZ - Advnced Mth Review Mtrix Multipliction Given! nd! find the sum of the elements of the product BA First, rewrite the mtrices in the correct order to multiply The product is BA hs order x since B is
More informationsuch that the S i cover S, or equivalently S
MATH 55 Triple Integrls Fll 16 1. Definition Given solid in spce, prtition of consists of finite set of solis = { 1,, n } such tht the i cover, or equivlently n i. Furthermore, for ech i, intersects i
More informationMa/CS 6b Class 1: Graph Recap
M/CS 6 Clss 1: Grph Recp By Adm Sheffer Course Detils Adm Sheffer. Office hour: Tuesdys 4pm. dmsh@cltech.edu TA: Victor Kstkin. Office hour: Tuesdys 7pm. 1:00 Mondy, Wednesdy, nd Fridy. http://www.mth.cltech.edu/~2014-15/2term/m006/
More informationLecture 10. Elementary Graph Algorithm Minimum Spanning Trees
Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo
More informationFile Manager Quick Reference Guide. June Prepared for the Mayo Clinic Enterprise Kahua Deployment
File Mnger Quick Reference Guide June 2018 Prepred for the Myo Clinic Enterprise Khu Deployment NVIGTION IN FILE MNGER To nvigte in File Mnger, users will mke use of the left pne to nvigte nd further pnes
More informationChapter 23. Minimum Spanning Trees
Chapter 23. Minimum Spanning Trees We are given a connected, weighted, undirected graph G = (V,E;w), where each edge (u,v) E has a non-negative weight (often called length) w(u,v). The Minimum Spanning
More informationCSCI 446: Artificial Intelligence
CSCI 446: Artificil Intelligence Serch Instructor: Michele Vn Dyne [These slides were creted by Dn Klein nd Pieter Abbeel for CS188 Intro to AI t UC Berkeley. All CS188 mterils re vilble t http://i.berkeley.edu.]
More informationThirty-fourth Annual Columbus State Invitational Mathematics Tournament. Instructions
Thirty-fourth Annul Columbus Stte Invittionl Mthemtics Tournment Sponsored by Columbus Stte University Deprtment of Mthemtics Februry, 008 ************************* The Mthemtics Deprtment t Columbus Stte
More information9 Graph Cutting Procedures
9 Grph Cutting Procedures Lst clss we begn looking t how to embed rbitrry metrics into distributions of trees, nd proved the following theorem due to Brtl (1996): Theorem 9.1 (Brtl (1996)) Given metric
More informationIntroduction to Algorithms. Minimum Spanning Tree. Chapter 23: Minimum Spanning Trees
Introdction to lgorithms oncrete example Imagine: Yo wish to connect all the compters in an office bilding sing the least amont of cable - ach vertex in a graph G represents a compter - ach edge represents
More informationAlignment of Long Sequences. BMI/CS Spring 2012 Colin Dewey
Alignment of Long Sequences BMI/CS 776 www.biostt.wisc.edu/bmi776/ Spring 2012 Colin Dewey cdewey@biostt.wisc.edu Gols for Lecture the key concepts to understnd re the following how lrge-scle lignment
More informationCompanion Mathematica Notebook for "What is The 'Equal Weight View'?"
Compnion Mthemtic Notebook for "Wht is The 'Equl Weight View'?" Dvid Jehle & Brnden Fitelson July 9 The methods used in this notebook re specil cses of more generl decision procedure
More informationIntegration. October 25, 2016
Integrtion October 5, 6 Introduction We hve lerned in previous chpter on how to do the differentition. It is conventionl in mthemtics tht we re supposed to lern bout the integrtion s well. As you my hve
More informationRational Numbers---Adding Fractions With Like Denominators.
Rtionl Numbers---Adding Frctions With Like Denomintors. A. In Words: To dd frctions with like denomintors, dd the numertors nd write the sum over the sme denomintor. B. In Symbols: For frctions c nd b
More informationMinimum Spanning Trees
Minimum Spanning Trees Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and no
More information6.4: SHELL METHOD 6.5: WORK AND ENERGY NAME: SOLUTIONS Math 1910 September 26, 2017
6.4: SHELL METHOD 6.5: WORK AND ENERGY NAME: SOLUTIONS Mt 9 September 26, 27 ONE-PAGE REVIEW Sell Metod: Wen you rotte te region between two grps round n xis, te segments prllel to te xis generte cylindricl
More informationHow to Design REST API? Written Date : March 23, 2015
Visul Prdigm How Design REST API? Turil How Design REST API? Written Dte : Mrch 23, 2015 REpresenttionl Stte Trnsfer, n rchitecturl style tht cn be used in building networked pplictions, is becoming incresingly
More informationITEC2620 Introduction to Data Structures
ITEC0 Introduction to Dt Structures Lecture 7 Queues, Priority Queues Queues I A queue is First-In, First-Out = FIFO uffer e.g. line-ups People enter from the ck of the line People re served (exit) from
More informationComplexity of Prim s Algorithm
The main loop is: Complexity of Prim s Algorithm while ( not ISEMPTY(Q) ): u = EXTRACT-MIN(Q) if p[u]!= NIL: A = A U {(p[u],u)} for v in adjacency-list[u]: if v in Q and w(u,v) < priority[v] : DECREASE-PRIORITY(v,
More informationPresentation Martin Randers
Presenttion Mrtin Rnders Outline Introduction Algorithms Implementtion nd experiments Memory consumption Summry Introduction Introduction Evolution of species cn e modelled in trees Trees consist of nodes
More informationPart VI Graph algorithms. Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths
Part VI Graph algorithms Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths 1 Chapter 22 Elementary Graph Algorithms Representations of graphs
More informationa < a+ x < a+2 x < < a+n x = b, n A i n f(x i ) x. i=1 i=1
Mth 33 Volume Stewrt 5.2 Geometry of integrls. In this section, we will lern how to compute volumes using integrls defined by slice nlysis. First, we recll from Clculus I how to compute res. Given the
More informationConstrained Optimization. February 29
Constrined Optimiztion Februry 9 Generl Problem min f( ) ( NLP) s.. t g ( ) i E i g ( ) i I i Modeling nd Constrints Adding constrints let s us model fr more richer set of problems. For our purpose we
More informationData sharing in OpenMP
Dt shring in OpenMP Polo Burgio polo.burgio@unimore.it Outline Expressing prllelism Understnding prllel threds Memory Dt mngement Dt cluses Synchroniztion Brriers, locks, criticl sections Work prtitioning
More informationMinimum spanning trees
Minimum spanning trees [We re following the book very closely.] One of the most famous greedy algorithms (actually rather family of greedy algorithms). Given undirected graph G = (V, E), connected Weight
More informationMIPS I/O and Interrupt
MIPS I/O nd Interrupt Review Floting point instructions re crried out on seprte chip clled coprocessor 1 You hve to move dt to/from coprocessor 1 to do most common opertions such s printing, clling functions,
More information6.3 Volumes. Just as area is always positive, so is volume and our attitudes towards finding it.
6.3 Volumes Just s re is lwys positive, so is volume nd our ttitudes towrds finding it. Let s review how to find the volume of regulr geometric prism, tht is, 3-dimensionl oject with two regulr fces seprted
More informationTree. number of vertices. Connected Graph. CSE 680 Prof. Roger Crawfis
Tree Introduction to lgorithms Spanning Trees CSE Prof. Roger Crawfis We call an undirected graph a tree if the graph is connected and contains no cycles. Trees: Not Trees: Not connected Has a cycle Number
More informationAllocator Basics. Dynamic Memory Allocation in the Heap (malloc and free) Allocator Goals: malloc/free. Internal Fragmentation
Alloctor Bsics Dynmic Memory Alloction in the Hep (mlloc nd free) Pges too corse-grined for llocting individul objects. Insted: flexible-sized, word-ligned blocks. Allocted block (4 words) Free block (3
More informationSuffix Tries. Slides adapted from the course by Ben Langmead
Suffix Tries Slides dpted from the course y Ben Lngmed en.lngmed@gmil.com Indexing with suffixes Until now, our indexes hve een sed on extrcting sustrings from T A very different pproch is to extrct suffixes
More informationCS60020: Foundations of Algorithm Design and Machine Learning. Sourangshu Bhattacharya
CS60020: Foundations of Algorithm Design and Machine Learning Sourangshu Bhattacharya Graphs (review) Definition. A directed graph (digraph) G = (V, E) is an ordered pair consisting of a set V of vertices
More informationCOMBINATORIAL PATTERN MATCHING
COMBINATORIAL PATTERN MATCHING Genomic Repets Exmple of repets: ATGGTCTAGGTCCTAGTGGTC Motivtion to find them: Genomic rerrngements re often ssocited with repets Trce evolutionry secrets Mny tumors re chrcterized
More informationQuestions About Numbers. Number Systems and Arithmetic. Introduction to Binary Numbers. Negative Numbers?
Questions About Numbers Number Systems nd Arithmetic or Computers go to elementry school How do you represent negtive numbers? frctions? relly lrge numbers? relly smll numbers? How do you do rithmetic?
More informationReducing a DFA to a Minimal DFA
Lexicl Anlysis - Prt 4 Reducing DFA to Miniml DFA Input: DFA IN Assume DFA IN never gets stuck (dd ded stte if necessry) Output: DFA MIN An equivlent DFA with the minimum numer of sttes. Hrry H. Porter,
More informationEngineer To Engineer Note
Engineer To Engineer Note EE-186 Technicl Notes on using Anlog Devices' DSP components nd development tools Contct our technicl support by phone: (800) ANALOG-D or e-mil: dsp.support@nlog.com Or visit
More informationMinimum Spanning Trees
CSMPS 2200 Fall Minimum Spanning Trees Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk 11/6/ CMPS 2200 Intro. to Algorithms 1 Minimum spanning trees Input: A
More information1 Quad-Edge Construction Operators
CS48: Computer Grphics Hndout # Geometric Modeling Originl Hndout #5 Stnford University Tuesdy, 8 December 99 Originl Lecture #5: 9 November 99 Topics: Mnipultions with Qud-Edge Dt Structures Scribe: Mike
More informationSection 10.4 Hyperbolas
66 Section 10.4 Hyperbols Objective : Definition of hyperbol & hyperbols centered t (0, 0). The third type of conic we will study is the hyperbol. It is defined in the sme mnner tht we defined the prbol
More informationIntroduction to Algorithms
Introduction to Algorithms 6.046J/18.401J LECTURE 13 Graph algorithms Graph representation Minimum spanning trees Greedy algorithms Optimal substructure Greedy choice Prim s greedy MST algorithm Prof.
More informationReducing Costs with Duck Typing. Structural
Reducing Costs with Duck Typing Structurl 1 Duck Typing In computer progrmming with object-oriented progrmming lnguges, duck typing is lyer of progrmming lnguge nd design rules on top of typing. Typing
More informationIntroduction to Algorithms
Introduction to Algorithms 6.046J/18.401J LECTURE 16 Greedy Algorithms (and Graphs) Graph representation Minimum spanning trees Optimal substructure Greedy choice Prim s greedy MST algorithm Prof. Charles
More informationLecture Overview. Knowledge-based systems in Bioinformatics, 1MB602. Procedural abstraction. The sum procedure. Integration as a procedure
Lecture Overview Knowledge-bsed systems in Bioinformtics, MB6 Scheme lecture Procedurl bstrction Higher order procedures Procedures s rguments Procedures s returned vlues Locl vribles Dt bstrction Compound
More informationIntroduction to Algorithms
Introduction to Algorithms, Lecture 1 /1/200 Introduction to Algorithms.04J/1.401J LECTURE 11 Graphs, MST, Greedy, Prim Graph representation Minimum spanning trees Greedy algorithms hallmarks. Greedy choice
More informationLooking up objects in Pastry
Review: Pstry routing tbles 0 1 2 3 4 7 8 9 b c d e f 0 1 2 3 4 7 8 9 b c d e f 0 1 2 3 4 7 8 9 b c d e f 0 2 3 4 7 8 9 b c d e f Row0 Row 1 Row 2 Row 3 Routing tble of node with ID i =1fc s - For ech
More informationProduct of polynomials. Introduction to Programming (in C++) Numerical algorithms. Product of polynomials. Product of polynomials
Product of polynomils Introduction to Progrmming (in C++) Numericl lgorithms Jordi Cortdell, Ricrd Gvldà, Fernndo Orejs Dept. of Computer Science, UPC Given two polynomils on one vrile nd rel coefficients,
More informationMemory-Optimized Software Synthesis from Dataflow Program Graphs withlargesizedatasamples
EURSIP Journl on pplied Signl Processing 2003:6, 54 529 c 2003 Hindwi Publishing orportion Memory-Optimized Softwre Synthesis from tflow Progrm Grphs withlrgesizetsmples Hyunok Oh The School of Electricl
More informationLecture 10 Evolutionary Computation: Evolution strategies and genetic programming
Lecture 10 Evolutionry Computtion: Evolution strtegies nd genetic progrmming Evolution strtegies Genetic progrmming Summry Negnevitsky, Person Eduction, 2011 1 Evolution Strtegies Another pproch to simulting
More information