


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Fundamental Algorithms; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Spring 2006;
Typology: Assignments
1 / 4
This page cannot be seen from the preview
Don't miss anything!



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.
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.
(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
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.
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.