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.pswp.cn/news/249061.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/249061.shtml
英文地址,請注明出處:http://en.pswp.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…