帮做CS 325 C/C++语言、C/C++程序代做、代写C/C++编程、C/C++设计代写

CS 325 – HW 5 1. (6 points) Consider an undirected graph G=(V,E) with nonnegative edge weights w(u,v)0. Suppose that you have computed a minimum spanning tree G, and that you have also computed shortest paths to all vertices from vertex sV. Now suppose each edge weight is increased by 1: the new weights w’(u,v) = w(u,v) + 1. (a) Does the minimum spanning tree change? Give an example it changes or prove it cannot change. (b) Do the shortest paths change? Give an example where they change or prove they cannot change. 2. (4 points) In the bottleneck-path problem, you are given a graph G with edge weights, two vertices s and t and a particular weight W; your goal is to find a path from s to t in which every edge has at least weight W. (a) Describe an efficient algorithm to solve this problem. (b) What is the running time of your algorithm. 3. (5 points) A region contains a number of towns connected by roads. Each road is labeled by the average number of minutes required for a fire engine to travel to it. Each intersection is labeled with a circle. Suppose that you work for a city that has decided to place a fire station at location G. (While this problem is small, you want to devise a method to solve much larger problems). (a) What algorithm would you recommend be used to find the fastest route from the fire station to each of the intersections? Demonstrate how it would work on the example above if the fire station is placed at G. Show the resulting routes. (b) Suppose one ”optimal” location (maybe instead of G) must be selected for the fire station such that it minimizes the distance to the farthest intersection. Devise an algorithm to solve this problem given an arbitrary road map. Analyze the time complexity o帮做CS 325 C/C++语言、C/C++程序代做留学生、代写C/C++编程、C/C++课程设计代写留学生f your algorithm when there are f possible locations for the fire station (which must be at one of the intersections) and r possible roads. (c) In the above graph what is the “optimal” location to place the fire station? 4. (15 points) Suppose there are two types of professional wrestlers: “Babyfaces” (“good guys”) and “Heels” (“bad guys”). Between any pair of professional wrestlers, there may or may not be a rivalry. Suppose we have n wrestlers and we have a list of r pairs of rivalries. CS 325 – HW 5 (a) Give pseudocode for an efficient algorithm that determines whether it is possible to designate some of the wrestlers as Babyfaces and the remainder as Heels such that each rivalry is between a Babyface and a Heel. If it is possible to perform. such a designation, your algorithm should produce it. (b) What is the running time of your algorithm? (c) Implement: Babyfaces vs Heels in C, C++ or Python. Name your program wrestler and include instructions on how to compile and execute your code in the README file. Input: Input is read in from a file specified in the command line at run time. The file contains the number of wrestlers, n, followed by their names, the number of rivalries r and rivalries listed in pairs. Note: The file only contains one list of rivalries Output: Results are outputted to the terminal.  Yes, if possible followed by a list of the Babyface wrestlers and a list of the Heels .  No, if impossible. Note: There can be alternative solutions. For consistency assign the first wrestler in the list to be a Babyface. Submit a copy of your files including a README file that explains how to compile and run your code in a ZIP file to TEACH. 转自:http://ass.3daixie.com/2018110618113586.html

你可能感兴趣的:(帮做CS 325 C/C++语言、C/C++程序代做、代写C/C++编程、C/C++设计代写)