# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

2 Pages

### hw5sol

Course: CS 2008, Fall 2009
School: Georgia Tech
Rating:

Word Count: 1036

#### Document Preview

3510: CS Design and Analysis of Algorithms Problem Set 5 Solutions Problem 1 Suppose that a communication network is modeled as a directed graph G = (V, E) in which each edge (u, v) E has an associated value 0 r(u, v) 1 that represents the probability that the channel from u to v will not fail. Assume that the probabilities are independent. Give an efficient algorithm that finds the most reliable path between...

Register Now

#### Unformatted Document Excerpt

Coursehero >> Georgia >> Georgia Tech >> CS 2008

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
3510: CS Design and Analysis of Algorithms Problem Set 5 Solutions Problem 1 Suppose that a communication network is modeled as a directed graph G = (V, E) in which each edge (u, v) E has an associated value 0 r(u, v) 1 that represents the probability that the channel from u to v will not fail. Assume that the probabilities are independent. Give an efficient algorithm that finds the most reliable path between two given vertices of a given network. Solution: For each edge (u, v) E, assign weight w(u, v) = - log r(u, v) if r(u, v) > 0, and w(u, v) = 0 otherwise. Run Dijkstra's algorithm on the G to find a shortest path from s to t, with respect to the new weights. We now show that this algorithm is correct. Because the probablities are independent, the probability that a path s = v0 v1 vk = t does not fail is k r(vi-1 , vi ). Thus findi=1 ing a most reliable path from s to t, i.e. maximizing k r(vi-1 , vi ), is equivalent to maximizing i=1 log k i=1 r(vi-1 , vi ) = = For 0 < r(u, v) < 1, log r(u, v) < 0. w(u, v) 0 for each (u, v) E, thus Dijkstra's algorithm applies. Alternatively, one can modify Dijkstra's algorithm to find the most reliable path. k i=1 (- log r(vi-1 , vi )) k i=1 log r(vi-1 , vi ). k i=1 w(vi-1 , vi ). The latter is equivalent to minimizing - k i=1 log r(vi-1 , vi ) = Therefore Problem 2 Let G = (V, E) be a weighted directed graph without negative-weight cycles, and let d be the maximum, over all (ordered) pairs of vertices u, v V , of the minimum number of edges in a shortest path from u to v in G. Give a simple modification to the Bellman-Ford algorithm so that the algorithm terminates in min (d + 1, n - 1) passes (as opposed to n - 1 passes), where n = |V |. Solution: By the path relaxation property, if the distance from s to a vertex v is , then a shortest path from s to v can be found in iterations of Bellman-Ford. Therefore, in d iterations, to every vertex a shortest path from s is found. Note that one cannot have the algorithm terminate in d iterations, since d was not known ahead of time. However, one can slightly modify the algorithm to terminate in d + 1 iterations: In each iteration, when relaxing each edge (u, v), check if Relax(u, v) yields any change. If there is no change for all edges, then to every vertex a shortest path from s has been found, so exit loop. Therefore d + 1 iterations suffice. Problem 3 Prove that Dijkstra's algorithm correctly computes single-source short paths in weighted directed graphs where edges leaving the source may have negative weights, but all other edge weights are nonnegative and there are no negative-weight cycles. Solution: Exactly the same proof for the case where all edge weights are nonnegative, applies to this case. 1 Problem 4 Let G = (V, E) be a weighted directed graph in which the edge are weights integers between 0 and w for some constant w. Give an implementation of Dijkstra's algorithm that computes shortest paths from a given source vertex of G in O(n + m) time, where n = |V | and m = |E|. Solution: First observe that for each vertex v V , at any time if d[v] < , then d[v] (n - 1)w. In order for d[v] < , an edge (u, v), with d[u] < , must be relaxed. It follows, by induction, that d[v] is at most the length of some simple path from s to v times the maximum edge weight, which is at most (n - 1)w. Also observe that in Dijkstra's algorithm, the values d[u] of vertices return by Extract-Min are monotonically increasing over time. The only way that such a value can change is by a Decrease-Key operation. Since the edge weights are nonnegative, when a vertex u is returned by Extract-Min and an edge (u, v) relaxed, we have d[u] d[v]. Thus every vertice extracted later has a value at least d[u]. We implement a priority queue so that every sequence of n Insert operations, n Extract-Min and m Decrease-Key operations take time O(n + m + k), where k = (n - 1)w Use an array A[0, ..., k], where A[j] consists of a doubly linked list of all elements whose value is j. Also have a separate list for vertices whose values are . The operations are implemented as follows: 1. Insert. To insert an element of value j, simply insert it into the list at A[j]. Time: O(1) per Insert. 2. Extract-Min. Maintain an index min of the smallest value extracted. To find an element of the smallest value, look at A[min]. If its list is nonempty, then remove an element from the list and return it. If the list is empty, then because of the monotonicity, increment min until a nonempty list is found (in which one removes an element from the list and return it, as before), or min > k (in which case the queue is empty). We increment min at most k times, and remove and return n elements. Thus the total time for all the Extract-Min operations is O(n + k). 3. Decrease-Key. To decrease the value of an elment from j to i, simply remove the element from the list A[j] and insert it into the list A[i]. Time: O(1) per Decrease-Key. Therefore, with this implementation, Dijkstra's algorithm runs in time O(n + m + k) = O(n + m + (n - 1)w) = O(n + m) since w = O(1). Problem 5 Let G = (V, E) be a weighted connected undirected graph where all edge weights are distinct. How many minimum spanning trees can G have? Justify your answer. (Note: I intended this to be Part (3) of Problem 3 in the last problem set (Problem Set 4), but forgot to include it.) Solution: G has a unique MST if all its edge weights are unique. By Part (2) of Problem 3 in Problem Set 4, if the lightest edge crossing every cut of G is unique, then G has a unique MST. This condition is certainly satisfied if all the edge weights in G are unique. 2
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Georgia Tech - CS - 3510
CS 3510: Design and Analysis of AlgorithmsProblem Set 5 SolutionsProblem 1Suppose that a communication network is modeled as a directed graph G = (V, E) in which each edge (u, v) E has an associated value 0 r(u, v) 1 that represents the probab
Georgia Tech - CS - 2008
CS 6505: Algorithms, Computability and ComplexityFinal Exam Due 11:59pm on December 11, 2007This take-home exam contains 8 problems. You are required to solve the 5 of the 8 problems. If you solve more than 5 problems, then the 5 highest scores of
Georgia Tech - CS - 6505
CS 6505: Algorithms, Computability and ComplexityFinal Exam Due 11:59pm on December 11, 2007This take-home exam contains 8 problems. You are required to solve the 5 of the 8 problems. If you solve more than 5 problems, then the 5 highest scores of
Georgia Tech - CS - 1371
function heat = temperaturePlot(ri, ro, Ti, To) r = linspace(ro, ri, 100); R = log (ro./r); Ri = log (ro/ri); T = To + (Ti-To)*R/Ri; plot(r, T, 'red'), grid on title('Temperature vs Radius') xlabel('radius') ylabel('temp') heat = 'done';
Georgia Tech - CS - 1050
CS1050B HW 1 Answer Key 24. [13 Points Each 39 Total] b. p T T T T F F F F d. p T T T T F F F F f. p T T T T F F F F q T T F F T T F F r T F T F T F T F (pq) T T F F F F F F (pq) r T T F T F T F T q T T F F T T F F q T T F F T T F F r T F T F T F T
Georgia Tech - CS - 2004
Computational Geometry: Homework 3. Due: 2/23/2004 1. Given n points on a circle, develop an algorithm that would construct an angle-optimal triangulation on these points (i.e. one with the largest possible angle vector). Of course, the faster the al
Georgia Tech - CS - 8803
Computational Geometry: Homework 3. Due: 2/23/2004 1. Given n points on a circle, develop an algorithm that would construct an angle-optimal triangulation on these points (i.e. one with the largest possible angle vector). Of course, the faster the al
Georgia Tech - CS - 2004
1 CS 6210 - Midterm Oct. 2002 Closed book and closed notes Your Name: Prof. Schwan Please make time to work on each question in this exam. Partial credit will be given whenever possible. 1) Short questions: 30 mins. (questions marked with * have mor
Georgia Tech - CS - 6210
1 CS 6210 - Midterm Oct. 2002 Closed book and closed notes Your Name: Prof. Schwan Please make time to work on each question in this exam. Partial credit will be given whenever possible. 1) Short questions: 30 mins. (questions marked with * have mor
Georgia Tech - CS - 4440
Introduction to Data Management in Mobile ComputingWai Gen Yee and Sham NavatheReference PapersDatabase System Issues in Nomadic Computing,Alonso and Korth, SIGMOD Challenge Session, 1993Mobile Wireless Computing: Challenges in Data Managemen
Georgia Tech - CS - 3500
Lecture 1, Tue Jan 6 '04. Today's Topics: Overview of Part 1: Algorithm Design Principles Paradigm Problems Driving Computer Technologies Primitives of Analysis of Algorithms: Correctness. Complexity (Time &amp; Space) in terms of input size n. Computa
Georgia Tech - CS - 6750
QualitativeThe s of C orie ognitionS tudying conte xtAge ndaQue stions Whe was P1 due n ? S eassum om ptions/proble s with pre m vious m ls ode S m of othe m ls of cognition um ary r ode S ituate action, activity the distribute d ory, d cognitio
Georgia Tech - CS - 6235
NGASSA DIANE MARIONECS 6235: Real-time SystemsProject proposal : Achieving Real-time constraints in wireless applications I- Goal The number of applications designed over wireless network keeps on increasing. Hence, it is necessary to find ways f
Georgia Tech - CS - 12
CS8803D Course Reading SummariesPaper #: 204Title: Application-Aware Adaptation for Mobile Computing(1) Problems1.The example in section three is really a different problem domain than what is talked about in the first two sections. The fir
Georgia Tech - CS - 8803
CS8803D Course Reading SummariesPaper #: 204Title: Application-Aware Adaptation for Mobile Computing(1) Problems1.The example in section three is really a different problem domain than what is talked about in the first two sections. The fir
Georgia Tech - CS - 12
CS8803D Course Reading SummariesPaper #: 198Title: PowerScope: A Tool for Profiling the Energy Usage of Mobile ApplicationsProblems:Energy efficiency is a major concern in the mobile computing enviornment. It has been realized that improveme
Georgia Tech - CS - 8803
CS8803D Course Reading SummariesPaper #: 198Title: PowerScope: A Tool for Profiling the Energy Usage of Mobile ApplicationsProblems:Energy efficiency is a major concern in the mobile computing enviornment. It has been realized that improveme
Georgia Tech - CS - 2001
GEORGIA INSTITUTE OF TECHNOLOGY College of ComputingCS6290 CS4290 | High-Performance Computer ArchitectureFall 2000 CS6290 CS4290 Homework 3 Issued: September 22, 2000 Due: September 29, 2000Purpose: Reading:This homework reviews pipeline opera
Georgia Tech - CS - 6290
GEORGIA INSTITUTE OF TECHNOLOGY College of ComputingCS6290 CS4290 | High-Performance Computer ArchitectureFall 2000 CS6290 CS4290 Homework 3 Issued: September 22, 2000 Due: September 29, 2000Purpose: Reading:This homework reviews pipeline opera
Georgia Tech - CS - 3500
CS 3500 Section C, Fall 2000Homework 6 due Wednesday, Oct. 4Problem 1 Problem 3.2, page 147 of Sipser. Problem 2 Give the complete description transition diagram or transition table of a deterministic Turingmachine recognizing the languagefw 2 f
Georgia Tech - CS - 1050
CS 1050 Section B, Spring 2001Homework 1 due Thursday, January 25Staple your solutions to the two parts separately and don't forget to write your name on each part.Part I Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6Exercise 8, pa
Georgia Tech - CS - 3500
CS 3500 Section C, Fall 2000Homework 10 due Thursday, Nov. 16Problem 1 Exercise 16.1 1, page 308 of CLR. Problem 2 Give examples showing that the following algorithms do not always nd the optimum matrix-chain multiplication. In other words you mus
Georgia Tech - CS - 3500
CS 3500 Section A Sample Mid-Term Exam Problem 1 (20 points) Give the state diagram of a DFA accepting the language specied by the regular expression 0 101 . (For half-credit you may give the diagram of an NFA with &quot;-transitions.) Problem 2 (10 point
Georgia Tech - CS - 2001
GEORGIA INSTITUTE OF TECHNOLOGY College of ComputingCS6290 CS4290 | High-Performance Computer ArchitectureFall 2000 CS6290 CS4290 Homework 7 Issued: October 29, 2000 Due: November 10, 2000 This homework covers predication and introduces some issues
Georgia Tech - CS - 6290
GEORGIA INSTITUTE OF TECHNOLOGY College of ComputingCS6290 CS4290 | High-Performance Computer ArchitectureFall 2000 CS6290 CS4290 Homework 7 Issued: October 29, 2000 Due: November 10, 2000 This homework covers predication and introduces some issues
Georgia Tech - CS - 1050
CS 1050 Section B, Spring 2001Homework 8 due Tuesday, April 17Part I Problem 1 Problem 2 Problem 3 Problem 4Exercise 18, page 317. Exercise 34, page 318. What is the solution to your recurrence? Exercise 4a,b,c, page 330. Exercise 14, page 337. W
Georgia Tech - CS - 2001
HCI + Game GenresStage Theory, Memory, Mental Models Action, Adventure, Puzzle, etcJ an 19 Spr i ng 2001CS44551Stage TheoryC Working memory is small temporary storageMaintenance rehearsal decay displacementAnswer to problem is orga
Georgia Tech - CS - 3500
Homework Assignment #3-Each problem worth 20 points1. Sipser 2.31. Sipser 2.4 b, e, g2. Sipser 2.5 b, e, g3. Sipser 2.6 a, b4. Sipser 2.15
Georgia Tech - CS - 2006
CS 6255: Midterm Exam Instructor: Dr. ClarkName: October 14, 2004CS 6255 Fall 2004 - Midterm ExamProblem Possible Score 1 20 2 20 3 10 4 20 5 30 Total 100You can use 1 page of notes plus the MIB-II and SMI specifications. Answer the questions
Georgia Tech - CS - 3500
CS 3500C THEORY IHomework 6 SolutionProblem 1: 20 Points SolutionGive context free grammars generating the following languages: {w : the length of w is odd }. S XSX|0|1 X 0|1 {w : the length of w is odd and its middle symbol is 0 }. S XSX|0 X
Georgia Tech - CS - 3500
CS 3500: Introduction to the Theory of ComputationProblem Set 5 Due July 8, 2003. Problem 1 [20 Points]Problem 7-4 on page 162 of CLRS.Problem 2 [20 Points]Problem 8-6 on page 180 of CLRS.Problem 3 [20 Points]Excercise 9.3-1 on page 192 of CL
Georgia Tech - CS - 3500
CS 3500: Introduction to the Theory of ComputationProblem Set 1 Due May 22, 2003 Problem 1 [20 Points]Exercise 1.4 parts (a) - (e) on page 84 of Sipser.Problem 2 [20 Points]Exercise 1.5 parts (a) - (e) on page 84 of Sipser.Problem 3 [10 Points
Georgia Tech - CS - 2003
Artificial Intelligence Encoding Planning ProblemsNilsson - Chapter 22 Russell and Norvig - Chapter 11.1 - 11.4, 11.8 initial state you are at home and don't have milk, bananas, and a drill goal state you are at home and have milk, bananas, and a dr
Georgia Tech - CS - 4600
Artificial Intelligence Encoding Planning ProblemsNilsson - Chapter 22 Russell and Norvig - Chapter 11.1 - 11.4, 11.8 initial state you are at home and don't have milk, bananas, and a drill goal state you are at home and have milk, bananas, and a dr
Georgia Tech - CS - 3500
CS 3500C THEORY IHomework 0 Solution Due: Not DueProblem 1: Growth RatesFor each function f (n) and time t in the following table, determine the largest size n of a problem that can be solved in time t, assuming that the algorithm to solve the p
Georgia Tech - CS - 2003
AIPS-98 Planning CompetitionArticial Intelligence Search-Based Planningnot in our text books Planning as Heuristic Search, Bonet and Geffner http:/www.ldc.usb.ve/~hector/reports/hsp-aij.ps Round 2 Round Round 1 Planner BLACKBOX HSP IPP STAN BLACKB
Georgia Tech - CS - 2003
GEORGIA INSTITUTE OF TECHNOLOGYCollege of Computing CS6290/CS4290 High-Performance Computer Architecture Spring 2003CS6290/CS4290 Homework 3Issued: February 14, 2003 Due: February 21, 2003Purpose: Problems:This homework reviews pipeline ope
Georgia Tech - CS - 6290
GEORGIA INSTITUTE OF TECHNOLOGYCollege of Computing CS6290/CS4290 High-Performance Computer Architecture Spring 2003CS6290/CS4290 Homework 3Issued: February 14, 2003 Due: February 21, 2003Purpose: Problems:This homework reviews pipeline ope
Georgia Tech - CS - 3500
CS 3500C THEORY IHomework 2, 1-29-03 Due: 2-5-03Problem 1: 30 PointsLet A[1 . . . n] be an array of n distinct numbers. Write a simple linear time algorithm to reverse the order in which the numbers appear on A[1 . . . n]. Use as little addition
Georgia Tech - CS - 2003
CS8803B Artificial Intelligence Lecture 24 - 10/16/02 Stephan UrbanskiKnowledge Based Reasoning / Learning(Specialization in AI Problem Solving is available as class next semester) We have come across the following kinds of knowledge: concepts* f
Georgia Tech - CS - 8803
CS8803B Artificial Intelligence Lecture 24 - 10/16/02 Stephan UrbanskiKnowledge Based Reasoning / Learning(Specialization in AI Problem Solving is available as class next semester) We have come across the following kinds of knowledge: concepts* f
Georgia Tech - CS - 3500
CS 3500C THEORY IHomework 5, 3-26-03 Due: 4-2-03 4pm. Firm.Problem 1: 20 PointsGive state diagrams of deterministic nite automata accepting the following languages. In all cases the alphabet is {0, 1}. {w : w does not contain the substring 110 }
Georgia Tech - CS - 2003
GEORGIA INSTITUTE OF TECHNOLOGYCollege of Computing CS6290/CS4290 High-Performance Computer Architecture Spring 2003CS6290/CS4290 Homework 5Issued: March 8, 2003 Due: April 4, 2003Purpose: Reading:This homework introduces issues in network
Georgia Tech - CS - 6290
GEORGIA INSTITUTE OF TECHNOLOGYCollege of Computing CS6290/CS4290 High-Performance Computer Architecture Spring 2003CS6290/CS4290 Homework 5Issued: March 8, 2003 Due: April 4, 2003Purpose: Reading:This homework introduces issues in network
Georgia Tech - CS - 2003
Articial Intelligence More Knowledge Representation and Reasoning (Approaches Other Than Logic)Nilsson - Chapters 18 Russell and Norvig - 10.5, 10.6Knowledge Representation and Reasoning; page 1 of 18planning operatorsFORALL s, x, store: At(st
Georgia Tech - CS - 4600
Articial Intelligence More Knowledge Representation and Reasoning (Approaches Other Than Logic)Nilsson - Chapters 18 Russell and Norvig - 10.5, 10.6Knowledge Representation and Reasoning; page 1 of 18planning operatorsFORALL s, x, store: At(st
Georgia Tech - CS - 2003
Classical Problem SolvingKnowledge Systems EngineeringCS 7613 Spring 2002Administrivia Class photo Mailing list? Laptop policyToday Skills survey results Getting and loading the BPS code Homework 0 Classical Problem Solvers2.80 2.60 2.
Georgia Tech - CS - 7613
Classical Problem SolvingKnowledge Systems EngineeringCS 7613 Spring 2002Administrivia Class photo Mailing list? Laptop policyToday Skills survey results Getting and loading the BPS code Homework 0 Classical Problem Solvers2.80 2.60 2.
Georgia Tech - CS - 2002
CS 4210 - Advanced Operating Systems - Summer 2002Final ExamThere are 110 points on this exam. Your grade will be measured as a percentage over 100 points, so in effect there are up to 10 extra credit points available. Point values are in () for ea
Georgia Tech - CS - 4210
CS 4210 - Advanced Operating Systems - Summer 2002Final ExamThere are 110 points on this exam. Your grade will be measured as a percentage over 100 points, so in effect there are up to 10 extra credit points available. Point values are in () for ea
Georgia Tech - CS - 4803
Problem 1(a) The forward and backward errors when using sin(x) x are shown below: x forward backward 0.1 0.000167 0.000167 0.5 0.0206 0.0236 1.0 0.1585 0.571 (b) The forward and backward errors when using sin(x) x x3 /6 are shown below: x forward
Georgia Tech - CSE - 6740
CSE 6740: Problem Set 1Problem Set 1: Density Estimation, Regression, and ClassicationDue: 5PM Friday, Oct. 10, 2008In this problem set, you will use FASTlib, a C+ library for machine learning algorithm development, to implement several algorith
Georgia Tech - CSE - 6740
CSE 6740 Lecture 17How Can I Reduce/Relate the Data Points? (Association and Clustering)Alexander Gray agray@cc.gatech.eduGeorgia Institute of Technology1 / 38Today1 2Associations ClusteringCentral tasks for data mining.2 / 38Associ
Georgia Tech - CSE - 6740
CSE 6740 Lecture 12What Loss Function Should I Use? (Estimation Theory)Alexander Grayagray@cc.gatech.eduGeorgia Institute of TechnologyCSE 6740 Lecture 12 p.1/33Today1. Robustness (&quot;How safe/stable is my loss function?&quot;) 2. Comparing Estim
Georgia Tech - CSE - 6740
CSE 6740 Lecture 25How Do I Evaluate High-Dimensional Integrals? (Sampling)Alexander Gray agray@cc.gatech.eduGeorgia Institute of Technology1 / 32Today1 2 3Integration and Sampling Monte Carlo Variance Reduction Markov Chain Monte Carlo
Georgia Tech - CSE - 6740
CSE 6740 Lecture 10What Loss Function Should I Use? (Maximum Likelihood and Bayesian Inference)Alexander Grayagray@cc.gatech.eduGeorgia Institute of TechnologyCSE 6740 Lecture 10 p.1/37Today1. Bayesian estimation 2. Should I be a Bayesian
Georgia Tech - CSE - 6740
CSE 6740 Lecture 23How Do I Optimize Convex/Linear Functions? (Unconstrained Linear Optimization)Alexander Gray agray@cc.gatech.eduGeorgia Institute of Technology1 / 30Today1 2 3Convex Optimization Problems Unconstrained Optimization: Lin
Georgia Tech - CSE - 6740
CSE 6740: Problem Set 2Problem Set 2: PCA, Kernels, and Graphical ModelsDue: 5PM Monday, Nov. 10, 2008First, download the datasets. All of the implementations should be done in FASTlib and submitted. Please be clear about which implementations c
Georgia Tech - CSE - 6740
CSE 6740 Lecture 21How Do I Learn Actions From Data? (Reinforcement Learning)Alexander Gray agray@cc.gatech.eduGeorgia Institute of Technology1/1Today1 2 3Reinforcement Learning RL Methods: Known Environment RL Methods: Unknown Environmen
Georgia Tech - CSE - 6740
FASTlib: A library for Fundamental Algorithmic and Statistical ToolsRyan Riegel and Nishant Mehtarriegel@cc.gatech.edu, niche@cc.gatech.eduFASTlab, Georgia Institute of TechnologyFASTlib: A library for Fundamental Algorithmic and Statistical To
Georgia Tech - CSE - 6740
CSE 6740 Lecture 14How Can I Learn Fancier (Nonlinear) Models? (Kernelization)Alexander Gray agray@cc.gatech.eduGeorgia Institute of Technology1 / 42Today1 2How to make more complex models using kernels Theory motivating kernels2 / 42