6 Solved Problems Assignment 2 - Fundamental Algorithms | CS 473, Assignments of Algorithms and Programming

Material Type: Assignment; Class: Fundamental Algorithms; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Spring 2006;

Typology: Assignments

Pre 2010

Uploaded on 03/16/2009

koofers-user-1cd
koofers-user-1cd 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 473g: Algorithms, Spring 2006
Homework 2 (due Tuesday, March 7, 2006 at 11:59.99 p.m.)
Version 1.1
Name:
Net ID: Alias:
Name:
Net ID: Alias:
# Score Grader
1.
2.
3.
4.
5.
6.
Total
If only I had a child,
curly-haired and dark
to take by his small hand
as we slowly walked through the park.
A child.
Uri I’d call him,
a name clear and mild,
a fragment of light.
“Uri!”
I’d call him,
my small, dark child.
Still, like Rachel
the Mother, I mourn,
like Hannah pray
for the unborn,
and wait, still wait
for my child.
Barren, Rachel
1
pf3
pf4

Partial preview of the text

Download 6 Solved Problems Assignment 2 - Fundamental Algorithms | CS 473 and more Assignments Algorithms and Programming in PDF only on Docsity!

CS 473g: Algorithms, Spring 2006

Homework 2 (due Tuesday, March 7, 2006 at 11:59.99 p.m.)

Version 1.

Name:

Net ID: Alias:

Name:

Net ID: Alias:

# Score Grader

Total

If only I had a child, curly-haired and dark to take by his small hand as we slowly walked through the park. A child. Uri I’d call him, a name clear and mild, a fragment of light. “Uri!” I’d call him, my small, dark child. Still, like Rachel the Mother, I mourn, like Hannah pray for the unborn, and wait, still wait for my child.

  • Barren, Rachel

Required Problems

  1. The good, the bad, and the middle. [10 Points] Suppose you’re looking at a flow network G with source s and sink t, and you want to be able to express something like the following intuitive notion: Some nodesare clearly on the “source side” of the main bottlenecks; some nodes are clearly on the “sink side” of the main bottlenecks; and some nodes are in the middle. However, G can have many minimum cuts, so we have to be careful in how we try making this idea precise. Here’s one way to divide the nodes of G into three categories of this sort. - We say a node v is upstream if, for all minimum s-t cuts (A, B), we have v ∈ A – that is, v lies on the source side of every minimum cut. - We say a node v is downstream if, for all minimum s-t cuts (A, B), we have v ∈ B – that is, v lies on the sink side of every minimum cut. - We say a node v is central if it is neither upstream nor downstream; there is at least one minimum s-t cut (A, B) for which v ∈ A, and at least one minimum s-t cut (A′, B′) for which v ∈ B′.

Give an algorithm that takes a flow network G and classifies each of its nodes as being upstream, downstream, or central. The running time of your algorithm should be within a constant factor of the time required to compute a single maximum flow.

  1. Ad hoc networks [20 Points] Ad hoc networks are made up of low-powered wireless devices, have been proposed for situa- tions like natural disasters in which the coordinators of a rescue effort might want to monitor conditions in a hard-to-reach area. The idea is that a large collection of these wireless devices could be dropped into such an area from an airplane and then configured into a functioning network. Note that we’re talking about (a) relatively inexpensive devices that are (b) being dropped from an airplane into (c) dangerous territory; and for the combination of reasons (a), (b), and (c), it becomes necessary to include provisions for dealing with the failure of a reasonable number of the nodes. We’d like it to be the case that if one of the devices v detects that it is in danger of failing, it should transmit a representation of its current state to some other device in the network. Each device has a limited transmitting range – say it can communicate with other devices that lie within d meters of it. Moreover, since we don’t want it to try transmitting its state to a device that has already failed, we should include some redundancy: A device v should have a set of k other devices that it can potentially contact, each within d meters of it. We’ll call this a back-up set for device v.

(a) Suppose you’re given a set of n wireless devices, with positions represented by an (x, y) coordinate pair for each. Design an algorithm that determines whether it is possible to choose a back-up set for each device (i.e., k other devices, each within d meters), with the further property that, for some parameter b, no device appears in the back-up set of

  1. [20 Points]

Consider an assignment problem where we have a set of n stations that can provide service, and there is a set of k requests for service. Say, for example, that the stations are cell towers and the requests are cell phones. Each request can be served by a given set of stations. The problem so far can be represented by a bipartite graph G: one side is the stations, the other the customers, and there is an edge (x, y) between customer x and station y if customer x can be served from station y. Assume that each station can serve at most one customer. Using a max-flow computation, we can decide whether or not all customers can be served, or can get an assignment of a subset of customers to stations maximizing the number of served customers. Here we consider a version of the problem with an addition complication: Each customer offers a different amount of money for the service. Let U be the set of customers, and assume that customer x ∈ U is willing to pay vx ≥ 0 for being served. Now the goal is to find a subset X ⊂ U maximizing

x∈X vx^ such that there is an assignment of the customers in^ X to stations. Consider the following greedy approach. We process customers in order of decreasing value (breaking ties arbitrarily). When considering customer x the algorithm will either “promise” service to x or reject x in the following greedy fasion. Let X be the set of customers that so far have been promised service. We add x to the set X if and only if there is a way to assign X ∪ {x} to servers, and we reject x otherwise. Note that rejected customers will not be considered later. (This is viewed as an advantage: If we need to reject a high-paying customer, at least we can tell him/her early.) However, we do not assign accepting customers to servers in a greedy fasion: we only fix the assignment after the set of accepted customers is fixed. Does this greedy approach produce an optimal set of customers? Prove that it does, or provide a counterexample.

  1. [20 Points]

Some friends of yours have grown tired of the game “Six Degrees of Kevin Bacon” (after all, they ask, isn’t it just breadth-first search?) and decide to invent a game with a little more punch, algorithmically speaking. Here’s how it works. You start with a set X of n actresses and a set Y of n actors, and two players P 0 and P 1. Player P 0 names an actress x 1 ∈ X, player P 1 names an actor y 1 who has appeared in a movie with x 1 , player P 0 names an actress x 2 who has appeared in a movie with y 1 , and so on. Thus, P 0 and P 1 collectively generate a sequence x 1 , y 1 , x 2 , y 2 ,... such that each actor/actress in the sequence has costarred with the actress/actor immediately preceding. A player Pi (i = 0, 1) loses when it is Pi’s turn to move, and he/she cannot name a member of his/her set who hasn’t been named before. Suppose you are given a specific pair of such sets X and Y , with complete information on who has appeared in a movie with whom. A strategy for Pi, in our setting, is an algorithm that takes a current sequence x 1 , y 1 , x 2 , y 2 ,... and generates a legal next move for Pi (assuming it’s Pi’s turn to move). Give a polynomial-time algorithm that decides which of the two players can force a win, in a particular instance of this game.