CSE5311 Design and Analysis of Algorithms
Fall 2009
September 28, 2009
Exercise Set 5
1. Suppose you are managing the construction of billboards on the Stephen Daedalus
Memorial Highway, a heavily traveled stretch of road that runs west-east for
M
miles.
The possible sites for billboards are given by numbers
x
1
,x
2
,…,x
n
, each in the interval
[
0,M
] (specifying their position along the highway measured in miles from its western
end). If you place a billboard at location
x
i
, you receive a revenue of
r
i
> 0. Regulations
imposed by the county’s Highway Department require that no two billboards be within
less than or equal to 5 miles of each other. You’d like to place billboards at a subset of
sites so as to maximize your total revenue, subject to this restriction.
2. Design a dynamic programming algorithm for the
change-making problem
: given an
amount
n
and unlimited quantities of coins of each of the denominations
d
1
,
d
2
, .
..
d
m
,
find the smallest number of coins that add up to
n
or indicate that the problem does not
have a solution.
3. Suppose we want to replicate a file over a collection of
n
servers, labeled
S
1
,S
2
,…, S
n
.
To place a copy of the file at server
S
i
results in a placement cost of
c
i
, where
c
i
is an
integer greater than 0. Now if a user requests the file from server
S
i
,
and no copy of the
file is present at
S
i
, then servers
S
i+1
,S
i+2
,…, S
i+3
… are searched in order until a copy of
the file is finally found, say at server
S
j
, where
j
>
i.
This results in an access cost of