首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代做CS4820、Java,Python编程代写
项目预算:
开发周期:
发布时间:
要求地区:
Introduction to Analysis of Algorithms HW7: Reductions, Flows, and Cuts
CS4820/5820 Fall 2023 Due: October 25, 11:59pm
Design-an-Algorithm Instructions: Homework problems often ask you to design an algorithm. In this case, you must:
1. explain your algorithm at a high level in English. You can use pseudocode (but not code) as
needed to make your ideas clearer, but remember to keep all explanations at a high level,
2. prove the algorithm’s correctness, and
3. analyze its running time, that is, you must show the running time is bounded by a polynomial function of the input size.
Reductions: You may sometimes realize that you can solve a homework problem using an algorithm from lecture or the textbook as a black box. We call this a reduction. In this case, you need
not explain the details of the existing algorithm, its running time and correctness. However, you
must fully explain the reduction by providing
1. a clear reference to the existing algorithm, along with the protocol that turns an instance
of the homework problem into an input for this algorithm,
2. a proof that the output given by the existing algorithm on the input created by your protocol
correctly solves the homework problem, and
3. a running time analysis that bounds the time of the combined process of creating the input for the existing algorithm, and executing the algorithm on this input by a polynomial
function of the homework problem’s input size.
Academic Integrity: You may not consult outside sources when working on the homework
(this means any resources besides your lecture notes, the textbook, and documents/information
contained on the course Canvas page / Ed discussion board).
Collaboration Policy: Collaboration (in groups of up to three students) is encouraged while
solving the problems, but:
1. list the netids of those in your group;
2. you may discuss ideas and approaches, but you should not write a detailed argument or
code outline together;
3. notes of your discussions should be limited to drawings and a few keywords; you must
write up the solutions and write code on your own.
We recommend solving the warm up questions (posted as a separate document) before you start
Homework 7.
Problem 1. A large street food company is deciding whether to start a business selling raw
herring in a European city. The company has information about potential vending opportunities
organized as an undirected graph G = (V, E). The node set V is a list of possible locations for
placing herring stalls. For each location v ∈ V , the company estimates a sales volume sv > 0.
Each herring sold gives a profit of p > 0. The company can choose multiple locations and assumes
the sales volumes at a location is independent of other locations selected (so if they choose a set
of locations S, the sales volume is P
v∈S
sv).
The edges of the graph represent the city streets. If the seller puts a herring stall at location v,
the city requires them to pay for street cleaning on all streets corresponding to edges incident to
v. Each edge e = (u, v) ∈ E is labeled with an integer ce > 0; if the company has a stall at one
or both of the locations u, v, it has to pay ce for cleaning the street represented by e.
The company will do business in the city if there is a set of stall locations S ⊆ V for which the
estimated profit is more than the cost of cleaning the streets incident to the chosen locations.
Design an algorithm that takes as input the graph G, the per-herring profit p, predicted sales
volume sv for each v ∈ V , and the cleaning cost ce for each e ∈ E and returns such a set S if it
exists. The runtime of your algorithm should be polynomial in n = |V |, m = |E|, and C =
X
e∈E
ce.
Problem 2. Implement your algorithm from Problem 1.
Input / output formatting and requirements. The algorithm should read in data from stdin
in the following expected format:
• The first line has three space-separated integers n, m and p;
• In the following n lines, the i-th line contains the expected sales volume at the i-th potential
location
• The following m lines contain the edges: each line has three space-separated integers
(u, v, c) with u, v ∈ {1, . . . , n} being the endpoints of the edge, and c ≥ 0 being the
cost of cleaning the corresponding street.
The algorithm should output data to stdout in two lines, where:
• the first line contains two space-separated integers giving the maximum profit and the
number of stations at which the company sells herring;
• the second line contains a space-separated list of the locations at which the company sells
herring.
In particular, if the optimal solution is to not sell any herrings, then the output should be 0\n\n
because the second line is an empty list (so not 0\n).
You may find it helpful to use the max flow code we posted on github.
2
Problem 3. There is an outbreak of a new highly contagious disease on the island nation Fifi.
There are two main cities on the island, Sourcisia and Targista, and the disease was detected only
in Sourcisia thus far.
In an attempt to ensure that the disease does not reach Targista, island officials are planning to
close off some of the towns; once a town is closed off, no traffic can pass through that town.
They have modeled the island as an undirected graph G = (V, E), where V contains a node for
Sourcisia and Targista, and a node for every other town on the island; each edge in E represents
a road between the towns. For each town v, you are also provided an integer p(v) > 0 giving the
size of the population of v.
They believe that closing off towns with more than P people in total will lead to a popular revolt, so they are asking your help to determine whether there is a set of towns whose combined
population is at most P such that closing off these towns will ensure that no traffic can go from
Sourcisia to Targista. (The cities of Sourcisia and Targista themselves are not eligible to being
closed off.)
Design an algorithm that determines whether such a set exists, and if so, returns a set of towns
with combined population at most P that can be closed off to ensure no traffic can go from
Sourcisia to Targista.
The runtime of your algorithm should be polynomial in n = |V |, m = |E|, and P
v
pv.
3
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!