Docsity

CSE 202 Final Examination: Algorithm Design and Analysis, Exams of Computer Science

Toggle sidebar
bg1
CSE 202 Final Examination
March 2010
Maximum points: 60
Due March 17, 3:00 PM. Return the solutions at CSE 4246. No late submissions.
Instructions:
1. Although this exam is an open book exam, you are only allowed to consult standard textbooks or lecture notes
that we used in the course. You cannot consult the WWW.
(a) Introduction to Algorithms (Cormen, Leiserson, Rivest, Stein)
(b) Algorithm Design by Kleinberg and Tardos
(c) Algorithms by Dasgupta, Papadimitriou and Vazirani
2. This test is designed to give you an opportunity to demonstrate your understanding of principles of algorithm
design, analysis and application. Consequently, you are required to work by yourself in answering the questions.
Group work or consultation with others is not allowed. You can check with the instructor or the TA for any
clarification.
3. Guidelines for writing a solution:
(a) Write your solutions neatly. Proofread them before you submit.
(b) Clearly state the main ideas and strategies used in developing the algorithm. The quality of the high-level
description of the algorithm is an essential determinant of your grade.
(c) Write the algorithm using a high-level pseudo language providing important details.
(d) If you are using a modified version of a well-known algorithm, show clearly what your modifications are.
(e) If you are using a well-known algorithm without any modifications, it is enough to specify how you plan
to apply the algorithm (for example, by specifying the input).
(f) Provide a detailed proof of correctness.
(g) Analyze the time complexity of your algorithm.
4. Well-written solutions will be rewarded. Characteristics of good solutions: correct solution, logical coherence,
an appropriate balance between completeness and succinctness, and an orderly presentation of ideas. Exces-
sively long solutions will be penalized.
5. There are a total of six problems each carrying ten points.
Problems:
1. Problem 29, Chapter 7, Page 433 (Kleinberg and Tardos)
2. A hotel manager must make reservations for the bridal suite for the coming ndays. The hotel has received a
variety of reservation requests (a total of mrequests) for various combinations of arrival and departure days.
Assume that the arrival date is always strictly less than the departure date. Note that as a party departs on a day,
another party can arrive on the same day. Each reservation would earn a different amount of revenue (always
non-negative) for the hotel due to a variety of rates and requirements. Design an efficient algorithm to schedule
the bridal suite with maximum profit for the hotel.
1
pf2

Partial preview of the text

Download CSE 202 Final Examination: Algorithm Design and Analysis and more Exams Computer Science in PDF only on Docsity!

CSE 202 Final Examination March 2010

Maximum points: 60

Due March 17, 3:00 PM. Return the solutions at CSE 4246. No late submissions.

Instructions:

  1. Although this exam is an open book exam, you are only allowed to consult standard textbooks or lecture notes that we used in the course. You cannot consult the WWW.

(a) Introduction to Algorithms (Cormen, Leiserson, Rivest, Stein) (b) Algorithm Design by Kleinberg and Tardos (c) Algorithms by Dasgupta, Papadimitriou and Vazirani

  1. This test is designed to give you an opportunity to demonstrate your understanding of principles of algorithm design, analysis and application. Consequently, you are required to work by yourself in answering the questions. Group work or consultation with others is not allowed. You can check with the instructor or the TA for any clarification.
  2. Guidelines for writing a solution:

(a) Write your solutions neatly. Proofread them before you submit. (b) Clearly state the main ideas and strategies used in developing the algorithm. The quality of the high-level description of the algorithm is an essential determinant of your grade. (c) Write the algorithm using a high-level pseudo language providing important details. (d) If you are using a modified version of a well-known algorithm, show clearly what your modifications are. (e) If you are using a well-known algorithm without any modifications, it is enough to specify how you plan to apply the algorithm (for example, by specifying the input). (f) Provide a detailed proof of correctness. (g) Analyze the time complexity of your algorithm.

  1. Well-written solutions will be rewarded. Characteristics of good solutions: correct solution, logical coherence, an appropriate balance between completeness and succinctness, and an orderly presentation of ideas. Exces- sively long solutions will be penalized.
  2. There are a total of six problems each carrying ten points.

Problems:

  1. Problem 29, Chapter 7, Page 433 (Kleinberg and Tardos)
  2. A hotel manager must make reservations for the bridal suite for the coming n days. The hotel has received a variety of reservation requests (a total of m requests) for various combinations of arrival and departure days. Assume that the arrival date is always strictly less than the departure date. Note that as a party departs on a day, another party can arrive on the same day. Each reservation would earn a different amount of revenue (always non-negative) for the hotel due to a variety of rates and requirements. Design an efficient algorithm to schedule the bridal suite with maximum profit for the hotel.
  1. We are given a directed graph G = (V, E) on which each edge (u, v) ∈ E has an associated value r(u, v), which is a real number in the range 0 ≤ r(u, v) ≤ 1 that represents the reliability of a communication channel from vertex u to vertex v. We interpret r(u, v) as the probability that the channel from u to v will not fail, and we assume that these probabilities are independent. Give an efficient algorithm to find the most reliable path between two given vertices. The reliability of a path is the product of the reliabilities of the edges along the path.
  2. Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more than n/ 3 times in the list. The algorithm should run in linear time. n is a nonnegative integer. You are expected to use comparisons and achieve linear time. You are neither expected to use hashing nor use excessive space. Moreover, you are expected to design a deterministic algorithm.
  3. Consider the following scheduling problem. You are given a set of n jobs, each of which has a time requirement ti. Each job can be done on one of two identical machines. The objective is to minimize the total time to complete all jobs, i.e., the maximum over the two machines of the total time of all jobs scheduled on the machine. A greedy heuristic would be to go through the jobs and schedule each on the machine with the least total work so far.

(a) Give an example (with the items in sorted order) where this heuristic is not optimal. (b) Assume the jobs are sorted in decreasing order of time required. Show an upper bound of 5 / 4 on the ratio between the optimal solution and that found by the greedy heuristic. 5 / 4 is not the best known ratio for this algorithm. You can do better. If you prove a ratio of 7/6 or better, you would get 5 extra credit points.

  1. Consider the following ”coupon collector” problem. There are a bunch of different varieties of cereal, and each comes with a single coupon for a discount on another box of cereal, perhaps of another variety. You can use multiple coupons when purchasing a new box, up to getting the new box free, but you never get money back. You want to buy one box of each variety, for as little money as possible. Describe an efficient algorithm, which, given as input, for each variety i ( 1 ≤ i ≤ n), its price pi, the value vi of the enclosed coupon, and the variety bi for which the coupon gives a discount, computes an optimal order in which to buy the cereal. Prove the correctness.