Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions
|
|
- Richard Holt
- 6 years ago
- Views:
Transcription
1 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 ad draw the DAG of strogly coected compoets. Label each strogly coected compoet with all the odes it cotais. B A J C D E F G H Draw the DAG i the box below: B AJ CDEGH F. (8 poits) Execute DFS o the same graph (reproduced here for coveiece) startig at ode A ad breakig ties alphabetically. Draw the DFS tree/forest. Mark the pre ad post values of the odes with umberig startig from 1.
2 B A J C D E F G H Node pre post A B C D E F G H J Draw the DFS Tree/Forest i the box below: B A J C D E F G H Node pre post A 1 4 B 5 18 C 6 17 D 7 16 E 8 15 F 11 1 G H 9 14 J 3 3. (4 poits) I the DFS executio from above, mark the followig edges as as T for Tree, F for Forward, B for Back ad C for Cross. (No justificatio ecessary)
3 Edge G! C A! J B! A B! D Type B T C F 4. (a) (4 poits) Draw a strogly coected graph with 6 vertices with the smallest possible umber of edges i the box below. A B C D E F (b) ( poits) I geeral, the miimum umber of edges i a strogly coected directed graph with vertices is. (o justificatio ecessary) You ca t have less tha edges as it will make the graph discoected. So the miimum is simply a loop through all the vertices. 5. (6 poits) Suppose G =(V,E) is a udirected graph with positive iteger edge weights {w e e E}. We would like to fid the shortest path betwee two vertices s ad t with a additioal requiremet: if there are multiple shortest paths, we would like to fid oe that has the miimum umber of edges. We would like to defie ew weights {w 0 e e E} for the edges so that, a sigle executio of Dijkstra s algorithm o the graph G with ew weights {w 0 e}, startig from s fids the shortest path to t with this additioal requiremet. How should we set the ew weights w 0 e No justificatio ecessary. w 0 e = w e + 1 V The ituitio here is that we wat to add somethig to the edges so that we ca di eretiate a path usig 4 edges ad a path usig 5 edges but with the same distace. I the meatime, we eed to make sure the origial Dijkstra s does t break. Therefore, we add the fractio 1 V so that the total legth of ay path will be icreased by at most 1. Sice all the edges are positive itegers, Dijkstra s will ru exactly the same as before. 6. (8 poits) Here is a implemetatio of Bellma-Ford algorithm: Iput: Directed Graph G =(V,E), with edge legths {`e e E}. Output: Compute distaces dist(u) to each vertex u from a start vertex s. 3
4 for i =1to do dist(u) 1 prev(u) il ed for dist(s) 0 k 0 repeat for i =1to do for each directed edge (i, j) do update(i, j) ed for ed for k k +1 util all dist values stop chagig OR (k = ) Algorithm 1: Bellma-Ford Algorithm It turs out that the rutime of the above algorithm ca be very sesitive to the way i which vertices i a graph are umbered. I other words, the rutime of the algorithm o the same graph ca widely vary, if we chage the umberig of the vertices. Give oe graph G o 11 vertices ad two ways to label the vertices of G, such that i oe labellig the algorithm makes 0 calls to update, while i the other labellig the algorithm termiates i 10 calls to update. The followig graph will call update exactly 0 times. A B C D E F G H I J K The followig graph will call update exactly 10 times. K J I H G F E D C B A 7. (6 poits) We computed the miimum spaig tree T o a graph G with costs {c e } ee. Ufortuately, after computig the miimum spaig tree, we discover that the costs of all the edges i the graph have chaged as follows: the ew cost w e are give by, w e = ( c e if c e > if c e apple 100 Is the tree T that we computed earlier, still a miimum spaig tree of the graph Write yes or o : yes If yes, prove; if o, disprove with a couterexample. Cosider a edge e that is part of the MST T composed from graph G with costs {c e } ee. will show that every such edge e must also be part of the MST T 0 after the weight update. We Case 1 Suppose c e apple 100, the w e = 0. Sice e was part of T, it is a edge with the miimal weight coectig 4
5 two sub-msts. If we have a edge e 0 such that c e 0 apple 100, the i the ew MST T, w e = w e 0. Thus edge e will still be part of MST T 0 as addig either e or e 0 would ot add ay cost to the total cost of T 0.Ifc e 0 > 100, the w e <w e 0 = 0 ad thus e is part of MST T 0. Case Now suppose c e > 100, the w e = c e. Suppose for the sake of cotradictio that e is ot part of MST T 0. There must be some edge e 0 part of MST T 0 coectig the two sub-msts that e is coectig. If w e 0 = 0, the c e 0 apple 100 <c e. Thus e 0 must be part of MST T rather tha e. This is a cotradictio because e is part of T ad havig both e ad e 0 coectig the two sub-msts would create a cycle ad violate the tree property. Now if w e 0,c e 0 > 100 ad we assume that e 0 is part of T 0 rather tha e, c e 0 < c e.thusc 0 e <c e. Agai e 0 must be part of MST T, a cotradictio. [The most commo mistake was to igore the case where a edge e of weight c e > 100 may be replaced by a edge e 0 with prior weight c e 0 apple 100. For full credit, we eeded a explaatio of why this case was impossible.] Alterative solutio A less commo, but correct alterative solutio was to argue that Kruskal s algorithm produces valid MSTs by cosiderig each edge e G i icreasig order of weight c e. The orderig of the edges is preserved i this update. Therefore, if T was a valid solutio produced by Kruskal s algorithm prior to the update, the T will remai a valid solutio after the update. 8. (6 poits) I this graph, some of the edge weights are kow, while the rest are ukow. B 3 E F 1 A D 4 C G H cost(a, D) =, cost(b,d) =1, cost(c,d) =4, cost(b,e) =3 List all edges that must belog to a miimum spaig tree, regardless of what the ukow edge weights tur out to be. Justify each of your edges briefly (a setece or less is eough). Edges that must belog to every MST Justificatio G H This is the oly edge that ca coect H to ay other vertex, so it must be icluded i ay MST. Remember that ay MST must spa all of the vertices. B D The cut property. More details: let S 1 = D, ad S = V S 1 = ABCEF GH. The three edges from the origial graph will coect these two forests, with edge weights: 1,, 4. So ay MST must cotai the B D edge of weight 1. B E Also by cut property. Cosider S 1 = ABD, ad S = V S 1 = CEFGH. The the 3 edge is the shortest edge coectig both forests. 5
6 Alterative justificatios: Ru Prim s MST algorithm, startig from H. H G is the shortest edge, so it will be added to the MST. The we kow at least oe MST will iclude this edge. Ad similarly, we ca ru Prim s, startig from D. ThetheD to the MST, so we kow at least oe MST will iclude D B. B edge is the first edge to be added But for B E, the Prim s argumet gets more complicated. You could argue that ruig Prim s startig from ay of ABD will always add the edge of weight 3, ad ever the edge of weight Desig a e ciet algorithm for the followig problem Iput: umbers {a 1,...,a } Goal: Compute the polyomial with a 1,...,a as its roots. I other words, compute coefficiets b 0,...,b so that (x a 1 ) (x a ) (x a )=b 0 + b 1 x +...b x. (Hit: Try divide ad coquer & use O( log ) time polyomial multiplicatio algorithm as a blackbox) (a) (10 poits) Pseudocode: procedure PolyomialWithRoots({a 1,...,a }): if =1the b 0 a 1 b 1 1 retur b 0,b 1 ed if q(x) PolyomialWithRoots({a 1,...,a b/c }) r(x) PolyomialWithRoots({a b/c,...,a }) p(x) MultiplyPolyomials(q(x), r(x)) retur coe ciets of p(x) (b) (3 poits) Write the recurrece for the ruig time of the algorithm i the box. T () = T + O( log ) (c) (6 poits) Solve the recurrece to compute the ruig time ad put your aswer i the box. Show your work below the box. T () = O( log ) To show this, we use the recurrece tree: log Sum: log log v ( log Sum: log! 4 log 4 4 log 4 4 log 4 }! 4 log 4 Sum: log 4. 6
7 The total, the, is log + log = log + log + log 4 + log = (log + (log log ) + (log log 4) + ) = ((log + log + + log ) (log + log log )) = (log ) ( log ) log log = log = log We could also use a more geeral versio of the Master Theorem, which states that if T () = at (/b) +f(), where a 1, b>1, ad f() = ( c log k )wherec = log b a,thet () = c log k+1. I this case, a = b =, c = 1 = log b a = log, ad k = (13 poits) You are give the road etwork G =(V,E) of a coutry, ad the legths {`e e E} of each road i the etwork. Some of the cities have airports, while others do t. Let F be the subset of cities that have a airport i them. Devise a algorithm to compute the distace from each city to the earest airport. (Assume that the graph is directed ad that all edge legths are o-egative). Remember every correct algorithm will receive a score depedig o its rutime. (ca you do it with the same ru-time as Dijkstra s). (a) Mai Idea: (try less tha 6 seteces if you ca, but do t fret if you go over) Reverse the graph. Add a dummy source vertex s to the graph. Add a zero weight edge from the source vertex to each airport. The ru Dijkstra o s to fid the distace from s to every vertex i the graph. This shortest distace from each city to the earest airport is the distace from the vertex that represets this city to vertex s. It is equivalet to merge all airports ito a sigle vertex or to ru a modified Dijkstra s i which all airports are iitialized with dist = 0. Brute force solutios were commo, ivolvig ruig Dijkstra from each vertex or just from each airport vertex. These are correct but ie ciet, as the ruig time will be O( V ( V + E ) log V ) or O( F ( V + E ) log V ), ad we have o boud o F except that it is at most V. (b) Rutime of the algorithm = O(( V + E ) log V ) (c) Proof of Correctess (try less tha 4 seteces if you ca, but do t fret if you go over) This is a directed graph ad the dummy ode s that we add is a source ode which has oly edges goig out ad o edges goig i. Thus addig the ode s wo t add a path betwee ay two odes from the origial graph. I additio, we set the legth of all edges of s to zero, so it wo t add ay additioal legth. Through Dijkstra (which we kow fids shortest distaces from a source ode to all others) we will fid the shortest distace from each ode to ode s (because 7
8 this is equivalet to the reversed path i the reversed graph), which is the same as the shortest path to ay airport. A brute force solutio ca be see to be correct by otig that Dijkstra will fid the shortest path betwee every relevat pair of odes, via multiple calls, ad that we ca compare them to fid the miimum i each case. 11. (10 poits) Suppose you are give a array A[1...] of sorted itegers that has bee circularly shifted k positios to the right for some k. For example, [35, 4, 5, 15, 7, 9] is a sorted array that has bee circularly shifted k = positios, while [7, 9, 35, 4, 5, 15] has bee shifted k = 4 positios. We ca obviously fid the largest elemet i A i O() time. Assumig all the itegers i the array are distict, describe a O(log ) algorithm to fid the largest elemet i A. Brief but precise descriptio of the algorithm: (try less tha 6 seteces if you ca, but do t fret if you go over) Mai idea: We wat to leverage the sorted-ess of the array, so we will implemet a modificatio of biary search where you always recurse o the usorted array. Compare A[0] ad A[mid] (where mid = d e). If A[0] <A[mid] the the left half of the array is sorted; the max value is either the mid or i the right half of the array. Store the mid as the temporary max ad repeat o the right half. If A[0] >A[mid] the the left half is usorted ad the max is somewhere i that array, so repeat o the left half. We ca also compare the mid poit with the last elemet. If A[last] <A[mid], we look at the right half of the array, icludig the mid poit. If A[last] >A[mid], we look at the left half of the array. Other splits are also possible. For example, comparig A[d 4 e]witha[d 3 4 e]. As log as a solutio compares poits that are far eough apart, it ca be used to determie the portio of the array to make the recursive call. If left poit is greater tha right poit, make the recursive call o the elemet betwee them. Otherwise the maximum elemet is i the other part of the array, which ca be obtaied by joiig the two parts i the same relative positioig, i.e. A[1,...,d 4 e]+a[d 3 4 e,...,]. A commo mistake was to compare immediate eighbors. But this ca oly be used to determie if the left elemet is the max. It does ot have eough iformatio to tell you which side the max is o ad thus caot obtai a O(log ) solutio. 8
Homework 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 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 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 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 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 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 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 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 informationModule 8-7: Pascal s Triangle and the Binomial Theorem
Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced
More information6.854J / J Advanced Algorithms Fall 2008
MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms
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 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 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 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 informationEE123 Digital Signal Processing
Last Time EE Digital Sigal Processig Lecture 7 Block Covolutio, Overlap ad Add, FFT Discrete Fourier Trasform Properties of the Liear covolutio through circular Today Liear covolutio with Overlap ad add
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 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 informationCIS 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 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 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 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 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 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 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 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 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 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 information1.2 Binomial Coefficients and Subsets
1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =
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 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 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 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 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 informationData Structures and Algorithms Part 1.4
1 Data Structures ad Algorithms Part 1.4 Werer Nutt 2 DSA, Part 1: Itroductio, syllabus, orgaisatio Algorithms Recursio (priciple, trace, factorial, Fiboacci) Sortig (bubble, isertio, selectio) 3 Sortig
More informationGraphs ORD SFO LAX DFW
Graphs SFO 337 1843 802 ORD LAX 1233 DFW Graphs A graph is a pair (V, E), where V is a set of odes, called vertices E is a collectio of pairs of vertices, called edges Vertices ad edges are positios ad
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 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 information3. b. Present a combinatorial argument that for all positive integers n : : 2 n
. b. Preset a combiatorial argumet that for all positive itegers : : Cosider two distict sets A ad B each of size. Sice they are distict, the cardiality of A B is. The umber of ways of choosig a pair of
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 informationDesign and Analysis of Algorithms Notes
Desig ad Aalysis of Algorithms Notes Notes by Wist Course taught by Dr. K Amer Course started: Jauary 4, 013 Course eded: December 13, 01 Curret geeratio: December 18, 013 Listigs 1 Array sum pseudocode.................................
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 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 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 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 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 informationOur Learning Problem, Again
Noparametric Desity Estimatio Matthew Stoe CS 520, Sprig 2000 Lecture 6 Our Learig Problem, Agai Use traiig data to estimate ukow probabilities ad probability desity fuctios So far, we have depeded o describig
More informationTHE PROBLEM THE PROBLEM (1) THE PROBLEM (2) THE MINIMUM ENERGY BROADCAST PROBLEM THE MINIMUM SPANNING TREE
THE MINIMUM ENERGY BROADCAST PROBLEM I.E. THE MINIMUM SPANNING TREE PROBLEM Prof. Tiziaa Calamoeri Network Algorithms A.y. 05/ THE PROBLEM THE PROBLEM () THE PROBLEM () What does it meas sufficietly close?!
More informationCHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs
CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics
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 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 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 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 informationCSE 417: Algorithms and Computational Complexity
Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm
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 informationGraphs. Shortest Path and Topological Sort
Graphs Shortest Path ad Topological Sort Example Relatioal Networks School Friedship Network (from Moody 2001) Yeast Metabolic Network (from https://www.d.edu/~etworks/cell/) Terrorist Network (by Valdis
More informationChapter 3 Classification of FFT Processor Algorithms
Chapter Classificatio of FFT Processor Algorithms The computatioal complexity of the Discrete Fourier trasform (DFT) is very high. It requires () 2 complex multiplicatios ad () complex additios [5]. As
More informationEE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering
EE 4363 1 Uiversity of Miesota Midterm Exam #1 Prof. Matthew O'Keefe TA: Eric Seppae Departmet of Electrical ad Computer Egieerig Uiversity of Miesota Twi Cities Campus EE 4363 Itroductio to Microprocessors
More informationCS 111: Program Design I Lecture 21: Network Analysis. Robert H. Sloan & Richard Warner University of Illinois at Chicago April 10, 2018
CS 111: Program Desig I Lecture 21: Network Aalysis Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago April 10, 2018 NETWORK ANALYSIS Which displays a graph i the sese of graph/etwork aalysis?
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 informationarxiv: v2 [cs.ds] 24 Mar 2018
Similar Elemets ad Metric Labelig o Complete Graphs arxiv:1803.08037v [cs.ds] 4 Mar 018 Pedro F. Felzeszwalb Brow Uiversity Providece, RI, USA pff@brow.edu March 8, 018 We cosider a problem that ivolves
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 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 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 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 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 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 informationc-dominating Sets for Families of Graphs
c-domiatig Sets for Families of Graphs Kelsie Syder Mathematics Uiversity of Mary Washigto April 6, 011 1 Abstract The topic of domiatio i graphs has a rich history, begiig with chess ethusiasts i the
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 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 informationMR-2010I %MktBSize Macro 989. %MktBSize Macro
MR-2010I %MktBSize Macro 989 %MktBSize Macro The %MktBSize autocall macro suggests sizes for balaced icomplete block desigs (BIBDs). The sizes that it reports are sizes that meet ecessary but ot sufficiet
More informationprerequisites: 6.046, 6.041/2, ability to do proofs Randomized algorithms: make random choices during run. Main benefits:
Itro Admiistrivia. Sigup sheet. prerequisites: 6.046, 6.041/2, ability to do proofs homework weekly (first ext week) collaboratio idepedet homeworks gradig requiremet term project books. questio: scribig?
More informationStrong Complementary Acyclic Domination of a Graph
Aals of Pure ad Applied Mathematics Vol 8, No, 04, 83-89 ISSN: 79-087X (P), 79-0888(olie) Published o 7 December 04 wwwresearchmathsciorg Aals of Strog Complemetary Acyclic Domiatio of a Graph NSaradha
More informationChapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 8 Strigs ad Vectors Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Slide 8-3 8.1 A Array Type for Strigs A Array Type for Strigs C-strigs ca be used to represet strigs
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 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 informationThe number n of subintervals times the length h of subintervals gives length of interval (b-a).
Simulator with MadMath Kit: Riema Sums (Teacher s pages) I your kit: 1. GeoGebra file: Ready-to-use projector sized simulator: RiemaSumMM.ggb 2. RiemaSumMM.pdf (this file) ad RiemaSumMMEd.pdf (educator's
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 informationEnd Semester Examination CSE, III Yr. (I Sem), 30002: Computer Organization
Ed Semester Examiatio 2013-14 CSE, III Yr. (I Sem), 30002: Computer Orgaizatio Istructios: GROUP -A 1. Write the questio paper group (A, B, C, D), o frot page top of aswer book, as per what is metioed
More informationThe Adjacency Matrix and The nth Eigenvalue
Spectral Graph Theory Lecture 3 The Adjacecy Matrix ad The th Eigevalue Daiel A. Spielma September 5, 2012 3.1 About these otes These otes are ot ecessarily a accurate represetatio of what happeed i class.
More informationChapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 8 Strigs ad Vectors Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 8.1 A Array Type for Strigs 8.2 The Stadard strig Class 8.3 Vectors Copyright 2015 Pearso Educatio, Ltd..
More informationCSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that.
CSE Notes 8: Sortig (Last updated //8 7:6 PM) CLRS 7.-7., 9., 8.-8. 8.A. QUICKSORT Cocepts Idea: Take a usorted (sub)array ad partitio ito two subarrays such that p q r x y z x y y z Pivot Customarily,
More informationSome non-existence results on Leech trees
Some o-existece results o Leech trees László A.Székely Hua Wag Yog Zhag Uiversity of South Carolia This paper is dedicated to the memory of Domiique de Cae, who itroduced LAS to Leech trees.. Abstract
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 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 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 informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to
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 informationInformed Search. Russell and Norvig Chap. 3
Iformed Search Russell ad Norvig Chap. 3 Not all search directios are equally promisig Outlie Iformed: use problem-specific kowledge Add a sese of directio to search: work toward the goal Heuristic fuctios:
More informationImage Segmentation EEE 508
Image Segmetatio Objective: to determie (etract) object boudaries. It is a process of partitioig a image ito distict regios by groupig together eighborig piels based o some predefied similarity criterio.
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 informationCounting Regions in the Plane and More 1
Coutig Regios i the Plae ad More 1 by Zvezdelia Stakova Berkeley Math Circle Itermediate I Group September 016 1. Overarchig Problem Problem 1 Regios i a Circle. The vertices of a polygos are arraged o
More information2. ALGORITHM ANALYSIS
2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times Lecture slides by Kevi Waye Copyright 2005 Pearso-Addiso
More informationNumerical Methods Lecture 6 - Curve Fitting Techniques
Numerical Methods Lecture 6 - Curve Fittig Techiques Topics motivatio iterpolatio liear regressio higher order polyomial form expoetial form Curve fittig - motivatio For root fidig, we used a give fuctio
More informationFundamentals of Media Processing. Shin'ichi Satoh Kazuya Kodama Hiroshi Mo Duy-Dinh Le
Fudametals of Media Processig Shi'ichi Satoh Kazuya Kodama Hiroshi Mo Duy-Dih Le Today's topics Noparametric Methods Parze Widow k-nearest Neighbor Estimatio Clusterig Techiques k-meas Agglomerative Hierarchical
More informationFast Fourier Transform (FFT) Algorithms
Fast Fourier Trasform FFT Algorithms Relatio to the z-trasform elsewhere, ozero, z x z X x [ ] 2 ~ elsewhere,, ~ e j x X x x π j e z z X X π 2 ~ The DFS X represets evely spaced samples of the z- trasform
More informationConsider the following population data for the state of California. Year Population
Assigmets for Bradie Fall 2016 for Chapter 5 Assigmet sheet for Sectios 5.1, 5.3, 5.5, 5.6, 5.7, 5.8 Read Pages 341-349 Exercises for Sectio 5.1 Lagrage Iterpolatio #1, #4, #7, #13, #14 For #1 use MATLAB
More informationLecture 9: Exam I Review
CS 111 (Law): Program Desig I Lecture 9: Exam I Review Robert H. Sloa & Richard Warer Uiversity of Illiois, Chicago September 22, 2016 This Class Discuss midterm topics Go over practice examples Aswer
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 information