CS 325 HW

代做CS 325作业、代写C, C++/Python编程设计作业、代做Python/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 of 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.
Sample Input file:
5
Ace
Duke
Jax
Biggs
Stone
6
Ace Duke
Ace Biggs
Jax Duke
Stone Biggs
Stone Duke
Biggs Jax
Sample Output:
Yeshttp://www.daixie0.com/contents/3/1995.html
Babyfaces: Ace Jax Stone
Heels: Biggs Duke
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.

 

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:99515681@qq.com 

微信:codinghelp

转载于:https://www.cnblogs.com/javanewpython/p/9931347.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/249061.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

express下使用ES6 - dtdxrk - 博客园

express下使用ES6 1 2 3 4 5 6 7 8 9 //环境切换配置 package.json scripts:{ "service": "NODE_ENVproduction PORT3000 npm start" } //node js判断 var app express(); app.get(env) production 原文地址:https://segmentfault.com/a…

java中的内部类详解

https://www.cnblogs.com/dolphin0520/p/3811445.html https://www.cnblogs.com/chenssy/p/3388487.html转载于:https://www.cnblogs.com/codeLei/p/9934195.html

eclipse下使用git插件上传代码至github

eclipse下使用git插件上传代码至github 1.eclipse下安装git 正常情况下,eclipse 是自带 git 插件的,那么即可跳至步骤1的最后一小步,配置 git 。 如果十分悲剧,你的 eclipse 中见不到 git 的身影,那么也没关系&#…

VS(C++)配置Halcon(一次配置,永久使用)

【说明】只需配置一次,以后新项目无需再次配置。 本教程是64位版本,32位可参考本教程。VS与Halcon无论哪个版本,都可参考本教程。 【步骤】以VS2015Halcon18.11为例 1、新建一个C|Win32控制台应用程序项目 2、视图|其他窗口|属性管理器 在 De…

(转)msys2使用教程

一、安装 官方下载地址 http://www.msys2.org/ 指定好安装路径(一般D根目录即可),一路下一步就好。 二、配置国内镜像、设置窗体修改颜色 使用[清华大学开源软件镜像站]中的地址,修改\etc\pacman.d目录下的三个文件。 配置教程 ht…

简单使用Git和Github来管理自己的代码和读书笔记

简单使用Git和Github来管理自己的代码和读书笔记 以前不知道使用代码管理工具,最后写的一些东西都没有了,由于硬盘坏了或者不小心格式化了之类的,后来使用了Git 和Github来托管自己的代码和读书笔记方便了不少,到哪里只要有网就可…

android 资源

在进行APP开发的过程当中,会用到许多资源,比如:图片,字符串等。现对android资源知识进行简单记录。 具体的详细信息及用法,点击查看官方文档 分类 一般android资源分为可直接访问的系统资源和不可直接访问的原生资源 r…

virtualbox 采用 NAT 还是 BRIDGE

正如标题所言,其实这两个都可以让虚拟机上网,但是还是有些差别的。 选择NAT的话, 虚拟机之间无法PING通 虚拟机可以PING通主机 主机无法PING通虚拟机 这是因为虚拟机不能在网络里拥有自己的IP,它是借助主机才能上网。 选择桥接的话…

vue 集成html5 plus - 懒懒de尐彪 - 博客园

首先要安装一个包 vue-html5plus npm i vue-html5plus -S 然后配置这个文件 在main.js添加一串代码 var onPlusReady function (callback, context this) { if (window.plus) { callback.call(context) } else { document.addEventListener(plusready, callback.bind(cont…

ssh整合学习(1)

Hibernate框架 1 hibernate核心配置文件 (0)orm思想 -对象关系映射 (1)数据库信息 (2)hibernate信息 (3)映射配置 (4)hibernate核心配置文件 -如果单纯使用hi…

MongoDB在不同主机间复制数据库和集合的教程_MongoDB_脚本之家

MongoDB在不同主机间复制数据库和集合的教程 更新时间:2016年07月04日 15:49:51 作者:lucifercn MongoDB自带了clone一族JavaScript函数来进行数据的复制,这里我们总结了MongoDB在不同主机间复制数据库和集合的教程,列举出了一些主从复制操作中常用…

2018-2019-2 网络对抗技术 20165305 Exp6 信息搜集与漏洞扫描

1.实践目标 掌握信息搜集的最基础技能与常用工具的使用方法。 2.实践内容 (1)各种搜索技巧的应用 (2)DNS IP注册信息的查询 (3)基本的扫描技术:主机发现、端口扫描、OS及服务版本探测、具体服务…

Java 观察者模式

定义:定义了对象之间的一对多依赖,让多个观察者对象同时监听某一个主题对象,当主题对象发生变化时,它的依赖者(观察者)都会收到通知并更新 适用场景: 关联行为场景,建立一套触发机制…

苹果电脑快捷键有哪些?mac系统快捷键大全详细介绍(全部)_苹果MAC_操作系统_脚本之家

苹果电脑快捷键有哪些?mac系统快捷键大全详细介绍(全部) 电脑中的每对快捷键有对应了一种操作效果,对于使用苹果电脑的操作系统的新人来说,快捷键是个很麻烦的问题,要一个个的找到快捷键也不是很容易的问题,本文就为大…

Oracle数据库基础入门《一》Oracle服务器的构成

Oracle数据库基础入门《一》Oracle服务器的构成 Oracle 服务器是一个具有高性能和高可靠性面向对象关系型数据库管理系统,也是一 个高效的 SQL 语句执行环境。 Oracle 服务器具备以下的特点: ● 能够可靠的进行多用户环境下大量数据的处理,允…

虚拟机配置域名

1.虚拟机的hosts文件 2.本地电脑的hosts文件 转载于:https://www.cnblogs.com/xiaobiaomei/p/10790907.html

查看端口、关闭端口

1.在dos命令下查看tomcat占用的进程,首先在运行里输入cmd进入dos,输入命令“netstat -ano | findstr 8080”(tomcat默认端口为8080)。查出PID(最后一列就是),假设PID为207340,输入命…

HTML5 新标签总汇

HTML5 新标签总汇 2010-12-16 20:44 聂微东 阅读(5060) 评论(8) 编辑 收藏 HTML5新标签总汇&#xff1a; 有问题欢迎指出,有关于CSS3方面的知识点较多,下周一前整理出来. <article> 标签定义外部的内容&#xff08;外部内容如blog,news&#xff09;。     …

Web文件管理器 elfinder-彩龙社区

最近接到一个需求&#xff0c;客户需要能在web页面进行文件管理&#xff0c;在需求调研时发现一个很好用的开源web文件管理器插件 elfinder&#xff0c;功能比较完善&#xff0c;社区也很活跃&#xff0c;方便二次开发&#xff0c;源码在GitHub上有将近3K的star&#xff0c;而且…

springmvc中对日期格式化的处理

DateTimeFormat(pattern"yyyy-MM-dd") 返回的时候java.util.Date pattern"yyyy-MM-dd"必须要和页面中的日期格式对应。 contraller层&#xff1a; package com.chenk.web.controller;import org.springframework.stereotype.Controller; import org.spring…