1 Disjoint-set data structure.
|
|
- Aubrey Dixon
- 5 years ago
- Views:
Transcription
1 CS 124 Setion #4 Union-Fin, Greey Algorithms 2/20/17 1 Disjoint-set ata struture. 1.1 Operations Disjoint-set ata struture enale us to effiiently perform operations suh as plaing elements into sets, querying whether two elements are in the same set, an merging two sets together. (Thus they re very useful for simulating graph onnetivity.) Must implement the following operations: makeset(): reate a new set ontaining the single element. union(, y): replae sets ontaining an y y their union. fin(): return name of set ontaining. We a for onveniene the funtion link(, y) where, y are roots: link hanges the parent pointer of one of the roots to e the other root. In partiular, union(, y) = link(fin(), fin(y)), so the main prolem is to make the fin operations effiient. 1.2 Optimization Heuristis We have two main methos of optimization for isjoint-set ata strutures: Union y rank. When performing a union operation, we prefer to merge the shallower tree into the eeper tree. Path ompression. After performing a fin operation, we an simply attah all the noes touhe iretly onto the root of the tree. Eerise 1. Draw how the isjoint set ata struture hanges after eah of the following operations using a partiular heuristi: (a) union(, y) with union y rank. a y () fin() with path ompression. 1
2 a e f g a y a e f g Eerise 2. When using the union y rank optimization only, what is the asymptoti runtime of the operation fin()? When we use the union y rank heuristi, we have the property that the rank of a tree only inreases when we union together two trees of the same rank. (Reall that rank = height). If you union a tree with rank 3 with one of rank 4, you get a tree of rank 4. Only when you union two trees of rank 4 an you get a tree of rank 5. 2
3 With this property, we an show that a tree of rank h has at least 2 h noes. This an e prove using inution. Base Case: When the rank of a tree is 0, there is always 1 noe, whih is inee at least 2 0. Inutive Case: Suppose it is true that every tree of rank h has at least 2 h noes. If we ha a tree of rank h + 1, we know that it must have ome aout through the union of two trees of rank h + 1 at some point in the history of this tree. By the inutive hypothesis, those two trees of rank h must have ha 2 h noes eah, an thus the numer of noes in this tree of rank h + 1 must e at least 2 h + 2 h = 2 h+1. Therefore, we have that the run-time of fin() when using only the union y rank heuristi is O(log n) eause if there are n noes, then the maimum rank of any tree is log n. 2 Greey Algorithms A greey algorithm is an algorithm whih attempts to fin the gloally optimal solution to a prolem y making loally optimal eisions. Eamples from Leture: Kruskal s: We greeily hoose the lightest ege in the graph that oesn t form a yle. Prim s: We greeily hoose the lightest ege ajaent to the spanning tree we ve forme so far. Horn Formula: We start y assigning all variales to false an only set variales to true when an impliation fores you to. Huffman Enoing: We greeily onstrut the enoing y taking the two least use haraters an merging them into one new harater. Set Cover (O(k log n) approimation): We greeily hoose the set that overs the most numer of the remaining unovere elements at the given iteration. In orer to prove that a greey algorithm is orret, we nee to show that inee hoosing the loally optimal solution keeps us on trak to fining the gloally optimal solution. The ut property with MST s guarantees that the greey MST algorithms are orret. Prolems with orret greey algorithms are rare. We will soon e introue to Dynami Programming, a tehnique that lets you solve a muh wier range of optimization prolems. It is argualy the most useful tehnique you will learn in CS 124. Eerise 3. Suppose that we have a set S = {a 1,..., a n } of propose ativities. Eah ativity a i has a start time s i an a finish time f i. We an only run one ativity at a time. Your jo is to fin a maimal set of ompatile ativities. Whih of the following greey algorithms is orret? (a) Sort all the ativities y their uration an greeily piking the shortest ativity that oes not onflit with any of the alreay hosen ativities. () Pik the ativity that onflits with the fewer numer of remaining ativities. Remove the ativities that the hosen ativity onflits with. Break ties aritrarily. 3
4 () Sort all the ativities y their en time an greeily pik the ativity with the earliest en time that oes not onflit with any of the alreay hosen ativities. (a) Inorret. It s not always est to hoose the shortest length ativities Counter-eample: () Inorret. This one is triky, ut it s not always est to hoose the ativity with the least a mount of onflits. Counter-eample: () Corret. Proof: Let g 1 e the first ativity hosen y the greey solution an let t 1 e the first ativity y the optimal solution. We know that ase on our seletion tehnique, g 1 is has the earliest en-time out of all the ativities, an thus the en time of t 1 must e equal to or after that of g 1. A similar argument an e mae for t 2 an g 2. We know that t 2 oes not overlap with g 1 eause g 1 ene efore t 1 ene. Therefore t 2 must en at the same time or later than g 2. This argument an e mae inutively to show that the en time of g i is always earlier than the en time of t i. Why oes this imply that the greey algorithm is optimal? Imagine a situation where we have one more ativity in the optimal solution than in greey. Let t l e the last event hosen y the optimal solution, ut suppose that greey only goes up to g l 1. Well we know y the informal inution we i that the en time of g l 1 is no later than the en time of t l 1. This implies that t l oes not onflit with g l 1. So why i the greey algorithm not hoose t l after hoosing g l 1? Contraition. Eerise 4. Let s go ak to greey. from the first CS 50 prolem set. The question was to etermine the fewest numer of US oins neessary to make hange for a given amount of money. (a) Desrie a greey algorithm to make hange onsisting of quarters, imes, nikels, an pennies. Prove that your algorithm yiels an optimal solution. () Suppose that the availale oins are in the enominations that are powers of, i.e., the enominations are 0, 1,..., k for some integers > 1 an k 1. Show that the greey algorithm always yiels an optimal solution. () Give a set of oin enominations for whih the greey algorithm oes not yiel an optimal solution. Your set shoul inlue a penny so that there is a solution for every value of n. (a) Our greey algorithm will e to use the largest oin at eah iteration. Suppose we are making 4
5 hange for n ents. If n < 5, then greey will use n pennies whih is optimal. If 6 n < 10, then greey will use one nikle an then n 5 pennies, whih is also optimal. If 11 n < 25, then greey will use a ime first. Can the optimal solution not use any imes? Notie that the optimal solution will never use more than 4 pennies or 1 nikel (eause otherwise you oul just always replae some of them with a nikle or a ime). 4 pennies an a nikle is only 9 ents, so it is efinitely su-optimal to not use a ime first when n is in this range. If n 25, y a similar reasoning as efore, we will never use more than 2 imes eause if you use 3 imes, you might as well replae it with a nikle an a quarter. Therefore, if n > 29, then ertainly we will use a quarter first. You an easily hek that if n is etween 25 an 29, then taking the quarter an then n 25 pennies is optimal. () We will generalize the argument use in the eample aove. The important realization was that you will never use more than 1 opies of a partiular oin eause otherwise you shoul replae opies of that oin with 1 opy of the net higher oin. The eeption is of ourse for the largest oin. Therefore, for any enomination n, let m e the size of the largest enomination less than n. If I only use oins of enomination m 1 an less, while using only at most 1 opies of eah, the maimum amount of money I oul make hange for is: m 1 ( 1) i = ( 1) m 1 1 = m 1 i=0 Given our assumption that n m, we know that it is impossile to have an optimal solution that oesn t use the oin with value m. () Suppose we only ha pennies, imes an quarters. Then, the optimal solution for n = 31 woul e to take 3 imes an a penny (4 oins total), ut the greey algorithm woul take 1 quarter an 6 pennies (7 oins total). Note that in this ase, it was est to take a oin with smaller value first (the penny) rather than the one with the highest value (the quarter). 3 Divie an Conquer Divie an Conquer algorithms work y reursively reaking the prolem into smaller piees an solving the suprolems. You nee to think aout how to reursively reak own the prolem as well as how to omine the various piees together. Eamples from Leture: Mergesort an StoogeSort: We reursively sorte a fration of the list an then i some work to omine those frations of the list together. 5
6 Integer Multipliation: We split two integers in half eah, forming 4 piees an then performe only 3 multipliations on half-size numers. Strassen s Algorithm: We perform matri multipliation on two n n matries y performing 7 multipliations on n/2 n/2 matries. Eerise 5. Given an array of n elements, you want to etermine whether there eists a majority element (that is an element whih ours at least n+1 2 times) an if so, output this element. Show how to o this in time O(n log n) using Divie an Conquer. Split the list into 2 halves an reursively fin the majority element of eah half. If oth sies return "no majority", then return "no majority". This is true eause if there eists a majority element, then it also has to e the majority on at least one of the two. If oth sies return an element, hek to see if the elements are the same an if so return it. Otherwise, for eah element returne y the reursive all, o a linear time traversal through the entire list to see if it is the majority element. Return it if it is an "no majority" if you on t etet a majority element this way. It is not har to onvine yourself that this algorithm is orret, ut what is its run-time? We make 2 reursive alls on lists of size n/2 an then perform up to 2 linear traversals through the list. Thus: T (n) = 2T (n/2) + O(n) whih solves to O(n log n) just like mergesort. Eerise 6. (2015 Prolem Set 4) You are given an n-igit positive integer written in ase-2. Give an effiient algorithm to return its representation in ase-10 an analyze its running time. Assume you have lak-o aess to an integer multipliation algorithm whih an multiply two n-igit numers in time M(n) for some M(n) whih is Ω(n) an O(n 2 ). Consier the n-igit ase-2 integer as a string of ase-2 igits, [0...n]. Assume n is a power of 2. If not, we an pa the left sie of the input integer with zeros. This will inrease the numer of igits y less than a fator of 2, whih will not affet the ig-o runtime. We offer a reursive algorithm. In the ase ase, for an input of size 0, output 0. Divie the integer into two halves, [0... n 2 ] an [ n 2...n]. Then, reursively onvert eah half into a ase-10 integer. Call these (onverte) ase-10 integers y l an y r. Then, the esire integer an e foun y omputing y l 2 n/2 + y r. Note that, p = 2 n/2 must e in ase-10 also. One way we oul get the ase-10 representation of p is y onverting it reursively, too, along with the halves of the input integer. Then we make three reursive alls to our proeure, eah with a ase-2 integer whih is roughly half the size of the prolem input. After we otain these ase-10 integers, we have to perform an integer multipliation (y l p) an an integer aition (y l p) + (yr). The run-time is: T (n) = 3T (n/2) + M(n/2) + O(n) Suppose M(n) = O(n k ) for some 1 k 2. Then, M(n/2) + O(n) = O(M(n/2)) = O(n k ). Thus, we an apply the master theorem on what k is: 6
7 If k > log 2 3, then T (n) = O(n k ). If k = log 2 3, then T (n) = O(n k log n) an if k < log 2 3, then T (n) = O(n log 2 3 ). 7
Solutions to Tutorial 2 (Week 9)
The University of Syney Shool of Mathematis an Statistis Solutions to Tutorial (Week 9) MATH09/99: Disrete Mathematis an Graph Theory Semester, 0. Determine whether eah of the following sequenes is the
More informationRegister Allocation III. Interference Graph Allocators. Computing the Interference Graph (in MiniJava compiler)
Register Alloation III Announements Reommen have interferene graph onstrution working by Monay Last leture Register alloation aross funtion alls Toay Register alloation options Interferene Graph Alloators
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 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 informationRegister Allocation III. Interference Graph Allocators. Coalescing. Granularity of Allocation (Renumber step in Briggs) Chaitin
Register Alloation III Last time Register alloation aross funtion alls Toay Register alloation options Interferene Graph Alloators Chaitin Briggs CS553 Leture Register Alloation III 1 CS553 Leture Register
More informationRecursion examples: Problem 2. (More) Recursion and Lists. Tail recursion. Recursion examples: Problem 2. Recursion examples: Problem 3
Reursion eamples: Problem 2 (More) Reursion and s Reursive funtion to reverse a string publi String revstring(string str) { if(str.equals( )) return str; return revstring(str.substring(1, str.length()))
More informationDivide-and-conquer algorithms 1
* 1 Multipliation Divide-and-onquer algorithms 1 The mathematiian Gauss one notied that although the produt of two omplex numbers seems to! involve four real-number multipliations it an in fat be done
More informationDynamic Algorithms Multiple Choice Test
3226 Dynami Algorithms Multiple Choie Test Sample test: only 8 questions 32 minutes (Real test has 30 questions 120 minutes) Årskort Name Eah of the following 8 questions has 4 possible answers of whih
More informationMenu. X + /X=1 and XY+X /Y = X(Y + /Y) = X
Menu K-Maps and Boolean Algera >Don t ares >5 Variale Look into my... 1 Karnaugh Maps - Boolean Algera We have disovered that simplifiation/minimization is an art. If you see it, GREAT! Else, work at it,
More informationLecture 14. Recursion
Leture 14 Reursion Announements for Today Prelim 1 Tonight at 5:15 OR 7:30 A D (5:15, Uris G01) E-K (5:15, Statler) L P (7:30, Uris G01) Q-Z (7:30, Statler) Graded y noon on Sun Sores will e in CMS In
More informationOutline. CS38 Introduction to Algorithms. Administrative Stuff. Administrative Stuff. Motivation/Overview. Administrative Stuff
Outline CS38 Introdution to Algorithms Leture 1 April 1, 2014 administrative stuff motivation and overview of the ourse stale mathings example graphs, representing graphs graph traversals (BFS, DFS) onnetivity,
More informationAlgorithms for External Memory Lecture 6 Graph Algorithms - Weighted List Ranking
Algorithms for External Memory Leture 6 Graph Algorithms - Weighted List Ranking Leturer: Nodari Sithinava Sribe: Andi Hellmund, Simon Ohsenreither 1 Introdution & Motivation After talking about I/O-effiient
More informationDynamic Programming. Lecture #8 of Algorithms, Data structures and Complexity. Joost-Pieter Katoen Formal Methods and Tools Group
Dynami Programming Leture #8 of Algorithms, Data strutures and Complexity Joost-Pieter Katoen Formal Methods and Tools Group E-mail: katoen@s.utwente.nl Otober 29, 2002 JPK #8: Dynami Programming ADC (214020)
More informationUnion Find. Data Structures and Algorithms Andrei Bulatov
Union Find Data Structures and Algorithms Andrei Bulatov Algorithms Union Find 6-2 Union Find In a nutshell, Kruskal s algorithm starts with a completely disjoint graph, and adds edges creating a graph
More information1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18
CS 124 Quiz 2 Review 3/25/18 1 Format You will have 83 minutes to complete the exam. The exam may have true/false questions, multiple choice, example/counterexample problems, run-this-algorithm problems,
More informationDivide-and-Conquer Algorithms
Supplment to A Practical Guie to Data Structures an Algorithms Using Java Divie-an-Conquer Algorithms Sally A Golman an Kenneth J Golman Hanout Divie-an-conquer algorithms use the following three phases:
More informationKeeping Things Simple: Finding Frequent Item Sets by Recursive Elimination
Keeping Things Simple: Fining Frequent Item Sets y Reursive Elimination Christian Borgelt Department of Knowlege Proessing an Language Engineering Shool of Computer Siene, Otto-von-Guerike-University of
More informationLAB 4: Operations on binary images Histograms and color tables
LAB 4: Operations on binary images Histograms an olor tables Computer Vision Laboratory Linköping University, Sween Preparations an start of the lab system You will fin a ouple of home exerises (marke
More informationDepartment of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Test I Solutions
Department of Eletrial Engineering and Computer iene MAACHUETT INTITUTE OF TECHNOLOGY 6.035 Fall 2016 Test I olutions 1 I Regular Expressions and Finite-tate Automata For Questions 1, 2, and 3, let the
More informationConnection Guide. Supported operating systems. Installing the printer using the Software and Documentation CD. Connection Guide
Connetion Guide Page 1 of 6 Connetion Guide Supported operating systems Using the software CD, you an install the printer software on the following operating systems: Windows 8.1 Windows Server 2012 R2
More informationIncremental Mining of Partial Periodic Patterns in Time-series Databases
CERIAS Teh Report 2000-03 Inremental Mining of Partial Periodi Patterns in Time-series Dataases Mohamed G. Elfeky Center for Eduation and Researh in Information Assurane and Seurity Purdue University,
More information1 The Knuth-Morris-Pratt Algorithm
5-45/65: Design & Analysis of Algorithms September 26, 26 Leture #9: String Mathing last hanged: September 26, 27 There s an entire field dediated to solving problems on strings. The book Algorithms on
More informationEnumerating pseudo-triangulations in the plane
Enumerating pseuo-triangulations in the plane Sergey Bereg Astrat A pseuo-triangle is a simple polygon with exatly three onvex verties. A pseuo-triangulation of a finite point set S in the plane is a partition
More informationAdvanced Algorithms for Fast and Scalable Deep Packet Inspection
Avane Algorithms for Fast an Salale Deep Paket Inspetion Sailesh Kumar Washington University sailesh@arl.wustl.eu Jonathan Turner Washington University jon.turner@wustl.eu John Williams Ciso Systems jwill@iso.om
More informationSolutions to Exam Data structures (X and NV)
Solutions to Exam Data structures X and NV 2005102. 1. a Insert the keys 9, 6, 2,, 97, 1 into a binary search tree BST. Draw the final tree. See Figure 1. b Add NIL nodes to the tree of 1a and color it
More informationCSE 421 Greedy Alg: Union Find/Dijkstra s Alg
CSE 1 Greedy Alg: Union Find/Dijkstra s Alg Shayan Oveis Gharan 1 Dijkstra s Algorithm Dijkstra(G, c, s) { d s 0 foreach (v V) d[v] //This is the key of node v foreach (v V) insert v onto a priority queue
More informationCMSC 430 Introduction to Compilers. Spring Register Allocation
CMSC 430 Introuction to Compilers Spring 2016 Register Allocation Introuction Change coe that uses an unoune set of virtual registers to coe that uses a finite set of actual regs For ytecoe targets, can
More informationLecture 15. Minimum Spanning Trees
Lecture 5 Minimum Spanning Trees nnouncements HW6 due FridaySUNY t s a long problem set Net week is Thanksgiving break, so there s no rush to get started on HW. You can use late days until Tuesday at 3pm.
More informationDefinitions Homework. Quine McCluskey Optimal solutions are possible for some large functions Espresso heuristic. Definitions Homework
EECS 33 There be Dragons here http://ziyang.ees.northwestern.edu/ees33/ Teaher: Offie: Email: Phone: L477 Teh dikrp@northwestern.edu 847 467 2298 Today s material might at first appear diffiult Perhaps
More informationDepartment of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I
MCA 312: Design and Analysis of Algorithms [Part I : Medium Answer Type Questions] UNIT I 1) What is an Algorithm? What is the need to study Algorithms? 2) Define: a) Time Efficiency b) Space Efficiency
More informationWhat is a minimal spanning tree (MST) and how to find one
What is a minimal spanning tree (MST) and how to find one A tree contains a root, the top node. Each node has: One parent Any number of children A spanning tree of a graph is a subgraph that contains all
More informationMachine Vision. Laboratory Exercise Name: Student ID: S
Mahine Vision 521466S Laoratory Eerise 2011 Name: Student D: General nformation To pass these laoratory works, you should answer all questions (Q.y) with an understandale handwriting either in English
More informationAlgorithms to Accelerate Multiple Regular Expressions Matching for Deep Packet Inspection
Algorithms to Aelerate Multiple Regular Expressions Mathing for Deep Paket Inspetion Sailesh Kumar Washington University Computer Siene an Engineering St. Louis, MO 60-899 +--9-06 sailesh@arl.wustl.eu
More informationLearning Convention Propagation in BeerAdvocate Reviews from a etwork Perspective. Abstract
CS 9 Projet Final Report: Learning Convention Propagation in BeerAdvoate Reviews from a etwork Perspetive Abstrat We look at the way onventions propagate between reviews on the BeerAdvoate dataset, and
More information9.4 Exponential Growth and Decay Functions
Setion 9. Eponential Growth and Dea Funtions 56 9. Eponential Growth and Dea Funtions S Model Eponential Growth. Model Eponential Dea. Now that we an graph eponential funtions, let s learn about eponential
More informationTriangle LMN and triangle OPN are similar triangles. Find the angle measurements for x, y, and z.
1 Use measurements of the two triangles elow to find x and y. Are the triangles similar or ongruent? Explain. 1a Triangle LMN and triangle OPN are similar triangles. Find the angle measurements for x,
More informationComparing Fisheye and Full-Zoom Techniques for Navigation of Hierarchically Clustered Networks
Comparing Fisheye an Full-Zoom Tehniques for Navigation of Hierarhially Clustere Networks Doug Shaffer*, Zhengping Zuo, Lyn Bartram, John Dill, Shelli Dus, Saul Greenerg*, Mark Roseman* 1 * Dept of Computer
More information10.2 Graph Terminology and Special Types of Graphs
10.2 Grph Terminology n Speil Types of Grphs Definition 1. Two verties u n v in n unirete grph G re lle jent (or neighors) in G iff u n v re enpoints of n ege e of G. Suh n ege e is lle inient with the
More informationEND-TERM EXAMINATION
(Please Write your Exam Roll No. immediately) Exam. Roll No... END-TERM EXAMINATION Paper Code : MCA-205 DECEMBER 2006 Subject: Design and analysis of algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt
More informationThis fact makes it difficult to evaluate the cost function to be minimized
RSOURC LLOCTION N SSINMNT In the resoure alloation step the amount of resoures required to exeute the different types of proesses is determined. We will refer to the time interval during whih a proess
More informationGreedy Algorithms Part Three
Greedy Algorithms Part Three Announcements Problem Set Four due right now. Due on Wednesday with a late day. Problem Set Five out, due Monday, August 5. Explore greedy algorithms, exchange arguments, greedy
More informationRouting Protocols for Wireless Ad Hoc Networks Hybrid routing protocols Theofanis Kilinkaridis
Routing Protools for Wireless Ad Ho Networks Hyrid routing protools Theofanis Kilinkaridis tkilinka@.hut.fi Astrat This paper presents a partiular group of routing protools that aim to omine the advantages
More informationCompilation Lecture 11a. Register Allocation Noam Rinetzky. Text book: Modern compiler implementation in C Andrew A.
Compilation 0368-3133 Leture 11a Text book: Modern ompiler implementation in C Andrew A. Appel Register Alloation Noam Rinetzky 1 Registers Dediated memory loations that an be aessed quikly, an have omputations
More informationAdditional Divide and Conquer Algorithms. Skipping from chapter 4: Quicksort Binary Search Binary Tree Traversal Matrix Multiplication
Aitional Divie an Conquer Algorithms Skipping from chapter 4: Quicksort Binary Search Binary Tree Traversal Matrix Multiplication Divie an Conquer Closest Pair Let s revisit the closest pair problem. Last
More informationBuilding a network. Properties of the optimal solutions. Trees. A greedy approach. Lemma (1) Lemma (2) Lemma (3) Lemma (4)
Chapter 5. Greedy algorithms Minimum spanning trees Building a network Properties of the optimal solutions Suppose you are asked to network a collection of computers by linking selected pairs of them.
More informationChapter 5. Greedy algorithms
Chapter 5. Greedy algorithms Minimum spanning trees Building a network Suppose you are asked to network a collection of computers by linking selected pairs of them. This translates into a graph problem
More informationConflicts Analysis for Inter-Enterprise Business Process Model
Conflits Analysis for nter-enterprise Business Proess Moel Wei DNG, Zhong TAN, Jian WANG, Jun ZHU, Haiqi LANG,Lei ZHANG {ingw, tianz, wangwj, zhujun, lianghq, lzhang}@n.ibm.om BM China Researh Lab, BM
More informationDijkstra s algorithm for shortest paths when no edges have negative weight.
Lecture 14 Graph Algorithms II 14.1 Overview In this lecture we begin with one more algorithm for the shortest path problem, Dijkstra s algorithm. We then will see how the basic approach of this algorithm
More informationPath Sharing and Predicate Evaluation for High-Performance XML Filtering*
Path Sharing and Prediate Evaluation for High-Performane XML Filtering Yanlei Diao, Mihael J. Franklin, Hao Zhang, Peter Fisher EECS, University of California, Berkeley {diaoyl, franklin, nhz, fisherp}@s.erkeley.edu
More informationCS 310 Advanced Data Structures and Algorithms
CS 0 Advanced Data Structures and Algorithms Weighted Graphs July 0, 07 Tong Wang UMass Boston CS 0 July 0, 07 / Weighted Graphs Each edge has a weight (cost) Edge-weighted graphs Mostly we consider only
More informationCSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo
CSE 431/531: Analysis of Algorithms Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast algorithms to solve
More informationChapter 2: Introduction to Maple V
Chapter 2: Introdution to Maple V 2-1 Working with Maple Worksheets Try It! (p. 15) Start a Maple session with an empty worksheet. The name of the worksheet should be Untitled (1). Use one of the standard
More informationLecture 4 Greedy algorithms
dvanced lgorithms loriano Zini ree University of ozen-olzano aculty of omputer Science cademic Year 203-20 Lecture Greedy algorithms hess vs Scrabble In chess the player must think ahead winning strategy
More informationCSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li
CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast
More informationAlgorithms (IX) Yijia Chen Shanghai Jiaotong University
Algorithms (IX) Yijia Chen Shanghai Jiaotong University Review of the Previous Lecture Shortest paths in the presence of negative edges Negative edges Dijkstra s algorithm works in part because the shortest
More informationA DYNAMIC ACCESS CONTROL WITH BINARY KEY-PAIR
Malaysian Journal of Computer Siene, Vol 10 No 1, June 1997, pp 36-41 A DYNAMIC ACCESS CONTROL WITH BINARY KEY-PAIR Md Rafiqul Islam, Harihodin Selamat and Mohd Noor Md Sap Faulty of Computer Siene and
More information-z c = c T - c T B B-1 A 1 - c T B B-1 b. x B B -1 A 0 B -1 b. (a) (b) Figure 1. Simplex Tableau in Matrix Form
3. he Revised Simple Method he LP min, s.t. A = b ( ),, an be represented by Figure (a) below. At any Simple step, with known and -, the Simple tableau an be represented by Figure (b) below. he minimum
More informationQuestions? Post on piazza, or Radhika (radhika at eecs.berkeley) or Sameer (sa at berkeley)!
EE122 Fall 2013 HW3 Instructions Recor your answers in a file calle hw3.pf. Make sure to write your name an SID at the top of your assignment. For each problem, clearly inicate your final answer, bol an
More informationCryptol Crib Sheet 1
Cryptol Crib Sheet 1 1 To Use Cryptol: 1. From the linux ommand line: prompt> to get this: Cryptol version 1.8.4, Copyright (C) 2004-2008 Galois, In. www..net Type :? for help Cryptol> 2. To load a soure
More informationOutline: Software Design
Outline: Software Design. Goals History of software design ideas Design priniples Design methods Life belt or leg iron? (Budgen) Copyright Nany Leveson, Sept. 1999 A Little History... At first, struggling
More informationCOP 4531 Complexity & Analysis of Data Structures & Algorithms
COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 8 Data Structures for Disjoint Sets Thanks to the text authors who contributed to these slides Data Structures for Disjoint Sets Also
More informationCS 161: Design and Analysis of Algorithms
CS 161: Design and Analysis of Algorithms Greedy Algorithms 2: Minimum Spanning Trees Definition The cut property Prim s Algorithm Kruskal s Algorithm Disjoint Sets Tree A tree is a connected graph with
More informationCSci 231 Final Review
CSci 231 Final Review Here is a list of topics for the final. Generally you are responsible for anything discussed in class (except topics that appear italicized), and anything appearing on the homeworks.
More informationAutomatic Physical Design Tuning: Workload as a Sequence Sanjay Agrawal Microsoft Research One Microsoft Way Redmond, WA, USA +1-(425)
Automati Physial Design Tuning: Workload as a Sequene Sanjay Agrawal Mirosoft Researh One Mirosoft Way Redmond, WA, USA +1-(425) 75-357 sagrawal@mirosoft.om Eri Chu * Computer Sienes Department University
More informationCIS 121 Data Structures and Algorithms Minimum Spanning Trees
CIS 121 Data Structures and Algorithms Minimum Spanning Trees March 19, 2019 Introduction and Background Consider a very natural problem: we are given a set of locations V = {v 1, v 2,..., v n }. We want
More informationMultitarget Data Association with Higher-Order Motion Models
Multitarget Data Assoiation with Higher-Orer Motion Moels Robert T. Collins The Pennsylvania State University University Park, PA 16802, USA Abstrat We present an iterative approximate solution to the
More informationUnion Find 11/2/2009. Union Find. Union Find via Linked Lists. Union Find via Linked Lists (cntd) Weighted-Union Heuristic. Weighted-Union Heuristic
Algorithms Union Find 16- Union Find Union Find Data Structures and Algorithms Andrei Bulatov In a nutshell, Kruskal s algorithm starts with a completely disjoint graph, and adds edges creating a graph
More informationAlgorithms for Minimum Spanning Trees
Algorithms & Models of Computation CS/ECE, Fall Algorithms for Minimum Spanning Trees Lecture Thursday, November, Part I Algorithms for Minimum Spanning Tree Sariel Har-Peled (UIUC) CS Fall / 6 Sariel
More informationDrawing lines. Naïve line drawing algorithm. drawpixel(x, round(y)); double dy = y1 - y0; double dx = x1 - x0; double m = dy / dx; double y = y0;
Naïve line drawing algorithm // Connet to grid points(x0,y0) and // (x1,y1) by a line. void drawline(int x0, int y0, int x1, int y1) { int x; double dy = y1 - y0; double dx = x1 - x0; double m = dy / dx;
More informationCS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics
CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics 1 Sorting 1.1 Problem Statement You are given a sequence of n numbers < a 1, a 2,..., a n >. You need to
More informationlooking ahead to see the optimum
! Make choice based on immediate rewards rather than looking ahead to see the optimum! In many cases this is effective as the look ahead variation can require exponential time as the number of possible
More informationFacility Location: Distributed Approximation
Faility Loation: Distributed Approximation Thomas Mosibroda Roger Wattenhofer Distributed Computing Group PODC 2005 Where to plae ahes in the Internet? A distributed appliation that has to dynamially plae
More informationmanaging an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm
Spanning Trees 1 Spanning Trees the minimum spanning tree problem three greedy algorithms analysis of the algorithms 2 The Union-Find Data Structure managing an evolving set of connected components implementing
More informationTriangles. Learning Objectives. Pre-Activity
Setion 3.2 Pre-tivity Preparation Triangles Geena needs to make sure that the dek she is building is perfetly square to the brae holding the dek in plae. How an she use geometry to ensure that the boards
More informationTotal 100
CS331 SOLUTION Problem # Points 1 10 2 15 3 25 4 20 5 15 6 15 Total 100 1. ssume you are dealing with a ompiler for a Java-like language. For eah of the following errors, irle whih phase would normally
More informationDisjoint set (Union-Find)
CS124 Lecture 6 Spring 2011 Disjoint set (Union-Find) For Kruskal s algorithm for the minimum spanning tree problem, we found that we needed a data structure for maintaining a collection of disjoint sets.
More informationSparse Certificates for 2-Connectivity in Directed Graphs
Sparse Certifiates for 2-Connetivity in Direted Graphs Loukas Georgiadis Giuseppe F. Italiano Aikaterini Karanasiou Charis Papadopoulos Nikos Parotsidis Abstrat Motivated by the emergene of large-sale
More informationAlgorithms and Data Structures: Minimum Spanning Trees (Kruskal) ADS: lecture 16 slide 1
Algorithms and Data Structures: Minimum Spanning Trees (Kruskal) ADS: lecture 16 slide 1 Minimum Spanning Tree Problem Given: Undirected connected weighted graph (G, W ) Output: An MST of G We have already
More informationUnion Find and Greedy Algorithms. CSE 101: Design and Analysis of Algorithms Lecture 8
Union Find and Greedy Algorithms CSE 101: Design and Analysis of Algorithms Lecture 8 CSE 101: Design and analysis of algorithms Union find Reading: Section 5.1 Greedy algorithms Reading: Kleinberg and
More informationMath 2201 Unit 3: Acute Triangle Trigonometry. Ch. 3 Notes
Rea Learning Goals, p. 17 text. Math 01 Unit 3: ute Triangle Trigonometry h. 3 Notes 3.1 Exploring Sie-ngle Relationships in ute Triangles (0.5 lass) Rea Goal p. 130 text. Outomes: 1. Define an aute triangle.
More informationA Compressed Breadth-First Search for Satisfiability
A Compressed Breadth-First Searh for Satisfiaility DoRon B. Motter and Igor L. Markov Department of EECS, University of Mihigan, 1301 Beal Ave, Ann Aror, MI 48109-2122 dmotter, imarkov @ees.umih.edu Astrat.
More informationThese are not polished as solutions, but ought to give a correct idea of solutions that work. Note that most problems have multiple good solutions.
CSE 591 HW Sketch Sample Solutions These are not polished as solutions, but ought to give a correct idea of solutions that work. Note that most problems have multiple good solutions. Problem 1 (a) Any
More information1 (15 points) LexicoSort
CS161 Homework 2 Due: 22 April 2016, 12 noon Submit on Gradescope Handed out: 15 April 2016 Instructions: Please answer the following questions to the best of your ability. If you are asked to show your
More informationPairwise alignment using shortest path algorithms, Gunnar Klau, November 29, 2005, 11:
airwise alignment using shortest path algorithms, Gunnar Klau, November 9,, : 3 3 airwise alignment using shortest path algorithms e will iscuss: it graph Dijkstra s algorithm algorithm (GDU) 3. References
More informationConnection Guide. Installing the printer locally (Windows) What is local printing? Installing the printer using the Software and Documentation CD
Page 1 of 7 Connetion Guide Installing the printer loally (Windows) Note: When installing a loally attahed printer, if the operating system is not supported y the Software and Doumentation CD, then the
More informationMinimum Spanning Trees. COMPSCI 355 Fall 2016
Minimum Spanning Trees COMPSCI all 06 Spanning Tree Spanning Tree Spanning Tree Algorithm A Add any edge that can be added without creating a cycle. Repeat until the edges form a spanning tree. Algorithm
More informationMinimum Spanning Trees
Minimum Spanning Trees Overview Problem A town has a set of houses and a set of roads. A road connects and only houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and
More informationCS2100 Computer Organisation Tutorial #8: MSI Components Answers to Selected Questions
C Computer Organisation Tutorial #8: MI Components Answers to elete Questions. Realize the following funtion with (a) an 8: multiplexer, an (b) a 4: multiplexer using the first input variables as the seletor
More informationGreedy algorithms is another useful way for solving optimization problems.
Greedy Algorithms Greedy algorithms is another useful way for solving optimization problems. Optimization Problems For the given input, we are seeking solutions that must satisfy certain conditions. These
More informationAbstract. We describe a parametric hybrid Bezier patch that, in addition. schemes are local in that changes to part of the data only aect portions of
A Parametri Hyrid Triangular Bezier Path Stephen Mann and Matthew Davidhuk Astrat. We desrie a parametri hyrid Bezier path that, in addition to lending interior ontrol points, lends oundary ontrol points.
More informationComputational Biology 6.095/6.895 Database Search Lecture 5 Prof. Piotr Indyk
Computational Biology 6.095/6.895 Database Searh Leture 5 Prof. Piotr Indyk Previous letures Leture -3: Global alignment in O(mn) Dynami programming Leture -2: Loal alignment, variants, in O(mn) Leture
More informationTest Case Generation from UML State Machines
Test Case Generation from UML State Mahines Dirk Seifert Loria Université Nany 2 Campus Sientifique, BP 239 F-54506 Vandoeuvre lès Nany edex Dirk.Seifert@Loria.fr inria-00268864, version 2-23 Apr 2008
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 informationAccelerating Multiprocessor Simulation with a Memory Timestamp Record
Aelerating Multiproessor Simulation with a Memory Timestamp Reord Kenneth Barr Heidi Pan Mihael Zhang Krste Asanovi Marh, 5 Massahusetts Institute of Tehnology Intelligent sampling gives est speed-auray
More informationRepresentations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs
Representations of Weighted Graphs (as Matrices) A B Algorithms and Data Structures: Minimum Spanning Trees 9.0 F 1.0 6.0 5.0 6.0 G 5.0 I H 3.0 1.0 C 5.0 E 1.0 D 28th Oct, 1st & 4th Nov, 2011 ADS: lects
More informationMITSUBISHI ELECTRIC RESEARCH LABORATORIES Cambridge, Massachusetts. Introduction to Matroids and Applications. Srikumar Ramalingam
Cmrige, Msshusetts Introution to Mtrois n Applitions Srikumr Rmlingm MERL mm//yy Liner Alger (,0,0) (0,,0) Liner inepenene in vetors: v, v2,..., For ll non-trivil we hve s v s v n s, s2,..., s n 2v2...
More informationProblem Strategies. 320 Greedy Strategies 6
Problem Strategies Weighted interval scheduling: 2 subproblems (include the interval or don t) Have to check out all the possibilities in either case, so lots of subproblem overlap dynamic programming:
More informationExample of why greedy step is correct
Lecture 15, Nov 18 2014 Example of why greedy step is correct 175 Prim s Algorithm Main idea:» Pick a node v, set A={v}.» Repeat: find min-weight edge e, outgoing from A, add e to A (implicitly add the
More informationComplex Rational Expressions
Comple ational Epressions What is a Comple ational Epression? A omple rational epression is similar to a omple fration whih has one or more frations in its numerator, denominator, or both The following
More informationInverse Design of Urban Procedural Models
Inverse Design of Uran Proeural Moels Carlos A. Vanegas Purue University U.C. Berkeley Ignaio Garia-Dorao Purue University Daniel G. Aliaga Purue University Development site Paul Waell U.C. Berkeley Non-optimize
More information