6.854J / J Advanced Algorithms Fall 2008
|
|
- Jacob Curtis
- 5 years ago
- Views:
Transcription
1 MIT OpeCourseWare J / J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit:
2 18.415/6.854 Advaced Algorithms September 17, 2008 Lecturer: Michel X. Goemas Lecture 5 Today, we cotiue the discussio of the miimum cost circulatio problem. We first review the Goldberg-Tarja algorithm, ad improve it by allowig more flexibility i the selectio of cycles. This gives the Cacel-ad-Tighte algorithm. We also itroduce splay trees, a data structure which we will use to create aother data structure, dyamic trees, that will further improve the ruig time of the algorithm. 1 Review of the Goldberg-Tarja Algorithm Recall the algorithm of Golberg ad Tarja for solvig the miimum cost circulatio problem: 1. Iitialize the flow with f = Repeatedly push flow alog the miimum mea cost cycle Γ i the residual graph G f, util o egative cycles exist. We used the otatio µ(f) = mi cycle Γ E f c(γ) Γ to deote the miimum mea cost of a cycle i the residual graph G f. I each iteratio of the algorithm, we push as much flow as possible alog the miimum mea cost cycle, util µ(f) 0. We used ɛ(f) to deote the miimum ɛ such that f is ɛ-optimal. I other words ɛ(f) = mi{ɛ : potetial p : V R such that c p (v, w) ɛ for all edges (v, w) E f }. We proved that for all circulatios f, ɛ(f) = µ(f). A cosequece of this equality is that there exists a potetial p such that ay miimum mea cost cycle Γ satisfies c p (v, w) = ɛ(f) = µ(f) for all (v, w) Γ, sice the cost of each edge is bouded below by mea cost of the cycle. 1.1 Aalysis of Goldberg-Tarja Let us recall the aalysis of the above algorithm. This will help us to improve the algorithm i order to achieve a better ruig time. Please refer to the previous lecture for the details of the aalysis. We used ɛ(f) as a idicatio of how close we are to the optimal solutio. We showed that ɛ(f) is a o-icreasig quatity, that is, if f is obtaied by f after a sigle iteratio, the ɛ(f ) ɛ(f). It remais to show that ɛ(f) decreases sigificatly after several iteratios. Lemma 1 Let f be ay circulatio, ad f be the circulatio obtaied after m iteratios of the Goldberg-Tarja algorithm. The ( ) 1 ɛ(f ) 1 ɛ(f). We showed that if the costs are all iteger valued, the we are doe as soo as we reach ɛ(f) < 1. Usig these two facts, we showed that the umber of iteratios of the above algorithm is at most O(m log(c)). A alterative aalysis usig ɛ-fixed edges provides a strogly polyomial boud of O(m 2 log ) iteratios. Fially, the ruig time per a sigle iteratio is O(m) usig a variat of Bellma-Ford (see problem set). 5-1
3 1.2 Towards a faster algorithm I the above algorithm, a sigificat amout of time is used to compute the miimum cost cycle. This is uecessary, as our goal is simply to cacel eough edges i order to achieve a sigificat improvemet i ɛ oce every several iteratios. We ca improve the algorithm by usig a more flexible selectio of cycles to cacel. The idea of the Cacel-ad-Tighte algorithm is to push flows alog cycles cosistig etirely of egative cost edges. For a give potetial p, we push as much flow as possible alog cycles of this form, util o more such cycles exist, at which poit we update p ad repeat. 2 Cacel-ad-Tighte 2.1 Descriptio of the Algorithm Defiitio 1 A edge is admissible with respect to a potetial p if c p (v, w) < 0. A cycle Γ is admissible if all the edges of Γ are admissible. Cacel ad Tighte Algorithm (Goldberg ad Tarja): 1. Iitializatio: f 0, p 0, ɛ max (v,w) E c(v, w), so that f is ɛ-optimal respect to p. 2. While f is ot optimum, i.e., G f cotais a egative cost cycle, do: (a) Cacel: While G f cotais a cycle Γ which is admissible with respect to p, push as much flow as possible alog Γ. (b) Tighte: Update p to p ad ɛ to ɛ (, where ) p ad ɛ are chose such that c p (v, w) ɛ for all edges (v, w) E f ad ɛ 1 1 ɛ. Remark 1 We do ot update the potetial p every time we push a flow. The potetial p gets updated i the tighte step after possibly several flows are pushed through i the Cacel step. Remark 2 I the tighte step, we do ot eed to fid p ad ɛ such that ɛ is as small as possible; it is oly ecessary to decrease ɛ by a factor of at least 1 1. However, i practice, oe tries to decrease ɛ by a smaller factor i order to obtai a better ruig time. Why is it always possible to obtai improvemet factor of 1 1 i each iteratio? This is guarateed by the followig result, whose proof is similar to the proof used i the aalysis durig the previous lecture. Lemma 2 Let f be a circulatio ad f be the circulatio obtaied by performig the Cacel step. The we cacel at most m cycles, ad ( ) 1 ɛ(f ) 1 ɛ(f). Proof: Sice we oly cacel admissible edges, after ay cycle is caceled i the Cacel step: All ew edges i the residual graph are o-admissible, sice the edge costs are skew-symmetric; At least oe admissible edge is removed from the residual graph, sice we push the maximum possible amout of flow through the cycle. 5-2
4 Sice we begi with at most m admissible edges, we caot cacel more tha m cycles, as each cycle cacelig reduces the umber of admissible edges by at least oe. After the cacel step, every cycle Γ cotais at least oe o-admissible edge, say (u 1, v 1 ) Γ with c p (u 1, v 1 ) 0. The the mea cost of Γ is ( ) ( ) c(γ) 1 c p (u, v) ( Γ 1) ɛ(f) = 1 1 ɛ(f) 1 1 ɛ(f). Γ Γ Γ Γ (u1,v 1 )=(u,v) Γ ( ) Therefore, ɛ(f ) = µ(f 1 ) 1 ɛ(f). 2.2 Implemetatio ad Aalysis of Ruig Time Tighte Step We first discuss the Tighte step of the Cacel-ad-Tighte algorithm. I this step, we wish to fid a ew potetial ( ) fuctio p ad a costat ɛ such that c p (v, w) ɛ for all edges (v, w) E f ad ɛ 1 1 ɛ. We ca fid the smallest possible ɛ i O(m) time by usig a variat of the Bellma-Ford algorithm. However, sice we do ot actually eed to fid the best possible ɛ, it is possible to vastly reduce the ruig time of the Tighte step to O(), as follows. Whe the Cacel step termiates, there are o cycles i the admissible graph G a = (V, A), the subgraph of the residual graph with oly the admissible edges. This implies that there exists a topological sort of the admissible graph. Recall that a topological sort of a directed acyclic graph is a liear orderig l : V {1,..., } of its vertices such that l(v) < l(w) if (v, w) is a edge of the graph; it ca be achieved i O(m) time usig a stadard topological sort algorithm (see, e.g., CLRS page 550). This liear orderig eables us to defie a ew potetial fuctio p by the equatio p (v) = p(v) l(v)ɛ/. We claim that this potetial fuctio satisfies our desired properties. Claim 3 The ew potetial fuctio p (v) = p(v) l(v)ɛ/ satisfies the property that f is ɛ -optimal with respect to p for some costat ɛ (1 1/)ɛ. Proof: Let (v, w) E f, the c p (v, w) = c(v, w) + p (v) p (w) = c(v, w) + p(v) l(v)ɛ/ p(w) + l(w)ɛ/ = c p (v, w) + (l(w) l(v))ɛ/. We cosider two cases, depedig o whether or ot l(v) < l(w). Case 1: l(v) < l(w). The c p (v, w) = c p (v, w) + (l(w) l(v))ɛ/ ɛ + ɛ/ = (1 1/)ɛ. Case 2: l(v) > l(w), so that (v, w) is ot a admissible edge. The c p (v, w) = c p (v, w) + (l(w) l(v))ɛ/ 0 ( 1)ɛ/ = (1 1/)ɛ. I either case, we see that f is ɛ -optimal with respect to p, where ɛ (1 1/)ɛ. 5-3
5 2.2.2 Cacel Step We ow shift our attetio to the implemetatio ad aalysis of the Cacel step. Naïvely, it takes O(m) time to fid a cycle i the admissible graph G a = (V, A) (e.g., usig Depth-First Search) ad push flow alog it. Usig a more careful implemetatio of the Cacel step, we shall show that each cycle i the admissible graph ca be foud i a amortized time of O(). We use a Depth-First Search (DFS) approach, pushig as much flow as possible alog a admissible cycle ad removig saturated edges, as well as removig edges from the admissible graph wheever we determie that they are ot part of ay cycle. Our algorithm is as follows: Cacel(G a = (V, A)): Choose a arbitrary vertex u V, ad begi a DFS rooted at u. 1. If we reach a vertex v that has o outgoig edges, the we backtrack, deletig from A the edges that we backtrack alog, util we fid a acestor r of v for which there is aother child to explore. (Notice that every edge we backtrack alog caot be part of ay cycle.) Cotiue the DFS by explorig paths outgoig from r. 2. If we fid a cycle Γ, the we push the maximum possible flow through it. This causes at least oe edge alog Γ to be saturated. We remove the saturated edges from A, ad start the depth-first-search from scratch usig G a = (V, A ), where A deotes A with the saturated edges removed. Every edge that is ot part of ay cycle is visited at most twice (sice it is removed from the admissible graph the secod time), so the time take to remove edges that are ot part of ay cycle is O(m). Sice there are vertices i the graph, it takes O() time to fid a cycle (excludig the time take to traverse edges that are ot part of ay cycle), determie the maximum flow that we ca push through it, ad update the flow i each of its edges. Sice at least oe edge of A is saturated ad removed every time we fid a cycle, it follows that we fid at most m cycles. Hece, the total ruig time of the Cacel step is O(m + m) = O(m) Overall Ruig Time From the above aalysis, we see that the Cacel step requires O(m) time per iteratio, whereas the Tighte step oly requires O(m) time per iteratio. I the previous lecture, we determied that the Cacel-ad-Tighte algorithm requires O(mi( log(c), m log )) iteratios. Hece the overall ruig time is O(mi(m 2 log(c), m 2 2 log )). Over the course of the ext few lectures, we will develop data structures that will eable us to reduce the ruig time of a sigle Cacel step from O(m) to O(m log ). Usig dyamic trees, we ca reduce the ruig time of the Cacel step to a amortized time of O(log ) per cycle caceled. This will reduce the overall ruig time to O(mi(m log(c) log, m 2 log 2 )). 3 Biary Search Trees I this sectio, we review some of the basic properties of biary search trees ad the operatios they support, before itroducig splay trees. A Biary Search Tree (BST) is a data structure that maitais a dictioary. It stores a collectio of objects with ordered keys. For a object (or ode) x, we use key[x] to deote the key of x. Property of a BST. The followig ivariat must always be satisfied i a BST: If y lies i the left subtree of x, the key[y] key[x] If z lies i the right subtree of x, the key[z] key[x] 5-4
6 Operatios o a BST. Here are some operatios typically supported by a BST: Fid(k): Determies whether the BST cotais a object x with key[x] = k; if so, returs the object, ad if ot, returs false. Isert(x): Iserts a ew ode x ito the tree. Delete(x): Deletes x from the tree. Mi: Fids the ode with the miimum key from the tree. Max: Fids the ode with the miimum key from the tree. Successor(x): Fid the ode with the smallest key greater tha key[x]. Predecessor(x): Fid the ode with the greatest key less tha key[x]. Split(x): Returs two BSTs: oe cotaiig all the odes y where key[y] < key[x], ad the other cotaiig all the odes z where key[z] key[x]. Joi(T 1, x, T 2 ): Give two BSTs T 1 ad T 2, where all the keys i T 1 are at most key[x], ad all the keys i T 2 are at least key[x], returs a BST cotaiig T 1, x ad T 2. For example, the procedure Fid(k) ca be implemeted by traversig through the tree, ad brachig to the left (resp. right) if the curret ode has key greater tha (resp. less tha) k. The ruig time for may of these operatios is liear i the height of the tree, which ca be as high as O() i the worst case, where is the umber of odes i the tree. A balaced BST is a BST whose height is maitaied at O(log ), so that the above operatios ca be ru i O(log ) time. Examples of BSTs iclude Red-Black trees, AVL trees, ad B-trees. I the ext lecture, we will discuss a data structure called splay trees, which is a self-balacig BST with amortized cost of O(log ) per operatio. The idea is that every time a ode is accessed, it gets pushed up to the root of the tree. The basic operatios of a splay tree are rotatios. They are illustrated the followig diagram. y x x zig (right rotatio) y C zag (left rotatio) A A B B C 5-5
CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19
CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13
CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis
More informationGraphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)
Graphs Miimum Spaig Trees Slides by Rose Hoberma (CMU) Problem: Layig Telephoe Wire Cetral office 2 Wirig: Naïve Approach Cetral office Expesive! 3 Wirig: Better Approach Cetral office Miimize the total
More informationMinimum Spanning Trees
Miimum Spaig Trees Miimum Spaig Trees Spaig subgraph Subgraph of a graph G cotaiig all the vertices of G Spaig tree Spaig subgraph that is itself a (free) tree Miimum spaig tree (MST) Spaig tree of a weighted
More information15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015
15-859E: Advaced Algorithms CMU, Sprig 2015 Lecture #2: Radomized MST ad MST Verificatio Jauary 14, 2015 Lecturer: Aupam Gupta Scribe: Yu Zhao 1 Prelimiaries I this lecture we are talkig about two cotets:
More informationHeaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder
More informationcondition w i B i S maximum u i
ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility
More informationBST Sequence of Operations
Splay Trees Problems with BSTs Because the shape of a BST is determied by the order that data is iserted, we ru the risk of trees that are essetially lists 12 21 20 32 24 37 15 40 55 56 77 2 BST Sequece
More informationHomework 1 Solutions MA 522 Fall 2017
Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More informationCSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)
CSC165H1, Witer 018 Learig Objectives By the ed of this worksheet, you will: Aalyse the ruig time of fuctios cotaiig ested loops. 1. Nested loop variatios. Each of the followig fuctios takes as iput a
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More informationLecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions
U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets
More informationDATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer
Data structures DATA STRUCTURES Static problems. Give a iput, produce a output. Ex. Sortig, FFT, edit distace, shortest paths, MST, max-flow,... amortized aalysis biomial heaps Fiboacci heaps uio-fid Dyamic
More informationCIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)
CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig
More informationData Structures and Algorithms. Analysis of Algorithms
Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output
More informationOutline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis
Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis
More informationLecture 5. Counting Sort / Radix Sort
Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018
More informationAnalysis of Algorithms
Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite
More informationMinimum Spanning Trees
Presetatio for use with the textbook, lgorithm esig ad pplicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 0 Miimum Spaig Trees 0 Goodrich ad Tamassia Miimum Spaig Trees pplicatio: oectig a Network Suppose
More informationMinimum Spanning Trees. Application: Connecting a Network
Miimum Spaig Tree // : Presetatio for use with the textbook, lgorithm esig ad pplicatios, by M. T. oodrich ad R. Tamassia, Wiley, Miimum Spaig Trees oodrich ad Tamassia Miimum Spaig Trees pplicatio: oectig
More informationData Structures Week #5. Trees (Ağaçlar)
Data Structures Week #5 Trees Ağaçlar) Trees Ağaçlar) Toros Gökarı Avrupa Gökarı October 28, 2014 Boraha Tümer, Ph.D. 2 Trees Ağaçlar) October 28, 2014 Boraha Tümer, Ph.D. 3 Outlie Trees Deiitios Implemetatio
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationPriority Queues. Binary Heaps
Priority Queues Biary Heaps Priority Queues Priority: some property of a object that allows it to be prioritized with respect to other objects of the same type Mi Priority Queue: homogeeous collectio of
More informationExamples and Applications of Binary Search
Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We
More information6.854J / J Advanced Algorithms Fall 2008
MIT OpenCourseWare http://ocw.mit.edu 6.854J / 18.415J Advanced Algorithms Fall 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advanced
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationLecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein
068.670 Subliear Time Algorithms November, 0 Lecture 6 Lecturer: Roitt Rubifeld Scribes: Che Ziv, Eliav Buchik, Ophir Arie, Joatha Gradstei Lesso overview. Usig the oracle reductio framework for approximatig
More informationCMPT 125 Assignment 2 Solutions
CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address
More informationSorting in Linear Time. Data Structures and Algorithms Andrei Bulatov
Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio
More informationAnalysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures
Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)
More informationCS 683: Advanced Design and Analysis of Algorithms
CS 683: Advaced Desig ad Aalysis of Algorithms Lecture 6, February 1, 2008 Lecturer: Joh Hopcroft Scribes: Shaomei Wu, Etha Feldma February 7, 2008 1 Threshold for k CNF Satisfiability I the previous lecture,
More informationWhat are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs
What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure
More informationThompson s Group F (p + 1) is not Minimally Almost Convex
Thompso s Group F (p + ) is ot Miimally Almost Covex Claire Wladis Thompso s Group F (p + ). A Descriptio of F (p + ) Thompso s group F (p + ) ca be defied as the group of piecewiseliear orietatio-preservig
More informationThe Magma Database file formats
The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,
More informationGreedy Algorithms. Interval Scheduling. Greedy Algorithms. Interval scheduling. Greedy Algorithms. Interval Scheduling
Greedy Algorithms Greedy Algorithms Witer Paul Beame Hard to defie exactly but ca give geeral properties Solutio is built i small steps Decisios o how to build the solutio are made to maximize some criterio
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationCS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1
CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()
More informationAlpha Individual Solutions MAΘ National Convention 2013
Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5
More informationComputational Geometry
Computatioal Geometry Chapter 4 Liear programmig Duality Smallest eclosig disk O the Ageda Liear Programmig Slides courtesy of Craig Gotsma 4. 4. Liear Programmig - Example Defie: (amout amout cosumed
More informationChapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4
More informationRandom Graphs and Complex Networks T
Radom Graphs ad Complex Networks T-79.7003 Charalampos E. Tsourakakis Aalto Uiversity Lecture 3 7 September 013 Aoucemet Homework 1 is out, due i two weeks from ow. Exercises: Probabilistic iequalities
More information5.3 Recursive definitions and structural induction
/8/05 5.3 Recursive defiitios ad structural iductio CSE03 Discrete Computatioal Structures Lecture 6 A recursively defied picture Recursive defiitios e sequece of powers of is give by a = for =0,,, Ca
More informationCIS 121. Introduction to Trees
CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,
More informationPerhaps the method will give that for every e > U f() > p - 3/+e There is o o-trivial upper boud for f() ad ot eve f() < Z - e. seems to be kow, where
ON MAXIMUM CHORDAL SUBGRAPH * Paul Erdos Mathematical Istitute of the Hugaria Academy of Scieces ad Reu Laskar Clemso Uiversity 1. Let G() deote a udirected graph, with vertices ad V(G) deote the vertex
More informationn n B. How many subsets of C are there of cardinality n. We are selecting elements for such a
4. [10] Usig a combiatorial argumet, prove that for 1: = 0 = Let A ad B be disjoit sets of cardiality each ad C = A B. How may subsets of C are there of cardiality. We are selectig elemets for such a subset
More informationSorting 9/15/2009. Sorting Problem. Insertion Sort: Soundness. Insertion Sort. Insertion Sort: Running Time. Insertion Sort: Soundness
9/5/009 Algorithms Sortig 3- Sortig Sortig Problem The Sortig Problem Istace: A sequece of umbers Objective: A permutatio (reorderig) such that a ' K a' a, K,a a ', K, a' of the iput sequece The umbers
More informationPattern Recognition Systems Lab 1 Least Mean Squares
Patter Recogitio Systems Lab 1 Least Mea Squares 1. Objectives This laboratory work itroduces the OpeCV-based framework used throughout the course. I this assigmet a lie is fitted to a set of poits usig
More informationΣ P(i) ( depth T (K i ) + 1),
EECS 3101 York Uiversity Istructor: Ady Mirzaia DYNAMIC PROGRAMMING: OPIMAL SAIC BINARY SEARCH REES his lecture ote describes a applicatio of the dyamic programmig paradigm o computig the optimal static
More informationMAXIMUM MATCHINGS IN COMPLETE MULTIPARTITE GRAPHS
Fura Uiversity Electroic Joural of Udergraduate Matheatics Volue 00, 1996 6-16 MAXIMUM MATCHINGS IN COMPLETE MULTIPARTITE GRAPHS DAVID SITTON Abstract. How ay edges ca there be i a axiu atchig i a coplete
More informationCS473-Algorithms I. Lecture 2. Asymptotic Notation. CS 473 Lecture 2 1
CS473-Algorithms I Lecture Asymptotic Notatio CS 473 Lecture 1 O-otatio (upper bouds) f() = O(g()) if positive costats c, 0 such that e.g., = O( 3 ) 0 f() cg(), 0 c 3 c c = 1 & 0 = or c = & 0 = 1 Asymptotic
More informationThe isoperimetric problem on the hypercube
The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose
More informationAlgorithms Chapter 3 Growth of Functions
Algorithms Chapter 3 Growth of Fuctios Istructor: Chig Chi Li 林清池助理教授 chigchi.li@gmail.com Departmet of Computer Sciece ad Egieerig Natioal Taiwa Ocea Uiversity Outlie Asymptotic otatio Stadard otatios
More informationA Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions
Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, 2006 316 A Geeralized Set Theoretic Approach for Time ad Space Complexity Aalysis of Algorithms
More informationBasic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.
5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator
More informationExact Minimum Lower Bound Algorithm for Traveling Salesman Problem
Exact Miimum Lower Boud Algorithm for Travelig Salesma Problem Mohamed Eleiche GeoTiba Systems mohamed.eleiche@gmail.com Abstract The miimum-travel-cost algorithm is a dyamic programmig algorithm to compute
More information1 Graph Sparsfication
CME 305: Discrete Mathematics ad Algorithms 1 Graph Sparsficatio I this sectio we discuss the approximatio of a graph G(V, E) by a sparse graph H(V, F ) o the same vertex set. I particular, we cosider
More informationCounting the Number of Minimum Roman Dominating Functions of a Graph
Coutig the Number of Miimum Roma Domiatig Fuctios of a Graph SHI ZHENG ad KOH KHEE MENG, Natioal Uiversity of Sigapore We provide two algorithms coutig the umber of miimum Roma domiatig fuctios of a graph
More informationLecture 18. Optimization in n dimensions
Lecture 8 Optimizatio i dimesios Itroductio We ow cosider the problem of miimizig a sigle scalar fuctio of variables, f x, where x=[ x, x,, x ]T. The D case ca be visualized as fidig the lowest poit of
More informationChapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3
More informationAlgorithm Design Techniques. Divide and conquer Problem
Algorithm Desig Techiques Divide ad coquer Problem Divide ad Coquer Algorithms Divide ad Coquer algorithm desig works o the priciple of dividig the give problem ito smaller sub problems which are similar
More informationFundamental Algorithms
Techische Uiversität Müche Fakultät für Iformatik Lehrstuhl für Effiziete Algorithme Dmytro Chibisov Sadeep Sadaada Witer Semester 2007/08 Solutio Sheet 6 November 30, 2007 Fudametal Algorithms Problem
More informationCombination Labelings Of Graphs
Applied Mathematics E-Notes, (0), - c ISSN 0-0 Available free at mirror sites of http://wwwmaththuedutw/ame/ Combiatio Labeligs Of Graphs Pak Chig Li y Received February 0 Abstract Suppose G = (V; E) is
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationComputer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.
Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must
More informationMath Section 2.2 Polynomial Functions
Math 1330 - Sectio. Polyomial Fuctios Our objectives i workig with polyomial fuctios will be, first, to gather iformatio about the graph of the fuctio ad, secod, to use that iformatio to geerate a reasoably
More informationAlgorithm. Counting Sort Analysis of Algorithms
Algorithm Coutig Sort Aalysis of Algorithms Assumptios: records Coutig sort Each record cotais keys ad data All keys are i the rage of 1 to k Space The usorted list is stored i A, the sorted list will
More informationChapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms
Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o
More informationLower Bounds for Sorting
Liear Sortig Topics Covered: Lower Bouds for Sortig Coutig Sort Radix Sort Bucket Sort Lower Bouds for Sortig Compariso vs. o-compariso sortig Decisio tree model Worst case lower boud Compariso Sortig
More informationCharacterizing graphs of maximum principal ratio
Characterizig graphs of maximum pricipal ratio Michael Tait ad Josh Tobi November 9, 05 Abstract The pricipal ratio of a coected graph, deoted γg, is the ratio of the maximum ad miimum etries of its first
More informationLoad balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers *
Load balaced Parallel Prime umber Geerator with Sieve of Eratosthees o luster omputers * Soowook Hwag*, Kyusik hug**, ad Dogseug Kim* *Departmet of Electrical Egieerig Korea Uiversity Seoul, -, Rep. of
More informationA graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))
ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:
More informationSymbolic Execution with Abstraction
Software Tools for Techology Trasfer mauscript No. (will be iserted by the editor) Symbolic Executio with Abstractio Saswat Aad 1, Coria S. Păsăreau 2, Willem Visser 3 1 College of Computig, Georgia Istitute
More information6.851: Advanced Data Structures Spring Lecture 17 April 24
6.851: Advaced Data Structures Sprig 2012 Prof. Erik Demaie Lecture 17 April 24 Scribes: David Bejami(2012), Li Fei(2012), Yuzhi Zheg(2012),Morteza Zadimoghaddam(2010), Aaro Berstei(2007) 1 Overview Up
More informationOur second algorithm. Comp 135 Machine Learning Computer Science Tufts University. Decision Trees. Decision Trees. Decision Trees.
Comp 135 Machie Learig Computer Sciece Tufts Uiversity Fall 2017 Roi Khardo Some of these slides were adapted from previous slides by Carla Brodley Our secod algorithm Let s look at a simple dataset for
More informationwhy study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms.
Chapter 5 Sortig IST311 - CIS65/506 Clevelad State Uiversity Prof. Victor Matos Adapted from: Itroductio to Java Programmig: Comprehesive Versio, Eighth Editio by Y. Daiel Liag why study sortig? Sortig
More informationChapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,
More informationAnalysis of Algorithms
Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms
More information15-850: Advanced Algorithms CMU, Spring 2017 Lecture #2: Randomized MST and Directed MSTs January 27, 2017
15-850: Advaced Algorithms CMU, Sprig 2017 Lecture #2: Radomized MST ad Directed MSTs Jauary 27, 2017 Lecturer: Aupam Gupta Scribe: Yu Zhao, Xiyu Wu 1 Prelimiaries I this lecture we itroduce the Karger-Klai-Tarja
More informationPolynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0
Polyomial Fuctios ad Models 1 Learig Objectives 1. Idetify polyomial fuctios ad their degree 2. Graph polyomial fuctios usig trasformatios 3. Idetify the real zeros of a polyomial fuctio ad their multiplicity
More informationAPPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS
APPLICATION NOTE PACE175AE BUILT-IN UNCTIONS About This Note This applicatio brief is iteded to explai ad demostrate the use of the special fuctios that are built ito the PACE175AE processor. These powerful
More informationThe golden search method: Question 1
1. Golde Sectio Search for the Mode of a Fuctio The golde search method: Questio 1 Suppose the last pair of poits at which we have a fuctio evaluatio is x(), y(). The accordig to the method, If f(x())
More informationData Structures Week #9. Sorting
Data Structures Week #9 Sortig Outlie Motivatio Types of Sortig Elemetary (O( 2 )) Sortig Techiques Other (O(*log())) Sortig Techiques 21.Aralık.2010 Boraha Tümer, Ph.D. 2 Sortig 21.Aralık.2010 Boraha
More informationChapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More informationParabolic Path to a Best Best-Fit Line:
Studet Activity : Fidig the Least Squares Regressio Lie By Explorig the Relatioship betwee Slope ad Residuals Objective: How does oe determie a best best-fit lie for a set of data? Eyeballig it may be
More informationINTERSECTION CORDIAL LABELING OF GRAPHS
INTERSECTION CORDIAL LABELING OF GRAPHS G Meea, K Nagaraja Departmet of Mathematics, PSR Egieerig College, Sivakasi- 66 4, Virudhuagar(Dist) Tamil Nadu, INDIA meeag9@yahoocoi Departmet of Mathematics,
More informationOrder statistics. Order Statistics. Randomized divide-andconquer. Example. CS Spring 2006
406 CS 5633 -- Sprig 006 Order Statistics Carola We Slides courtesy of Charles Leiserso with small chages by Carola We CS 5633 Aalysis of Algorithms 406 Order statistics Select the ith smallest of elemets
More informationHash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative
More informationProtected points in ordered trees
Applied Mathematics Letters 008 56 50 www.elsevier.com/locate/aml Protected poits i ordered trees Gi-Sag Cheo a, Louis W. Shapiro b, a Departmet of Mathematics, Sugkyukwa Uiversity, Suwo 440-746, Republic
More informationOn (K t e)-saturated Graphs
Noame mauscript No. (will be iserted by the editor O (K t e-saturated Graphs Jessica Fuller Roald J. Gould the date of receipt ad acceptace should be iserted later Abstract Give a graph H, we say a graph
More informationMajor CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70
NOTE:. Attempt all seve questios. Major CSL 02 2. Write your ame ad etry o o every sheet of the aswer script. Time 2 Hrs Max Marks 70 Q No Q Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Total MM 6 2 4 0 8 4 6 70 Q. Write a
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 19 Query Optimizatio Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Query optimizatio Coducted by a query optimizer i a DBMS Goal:
More information