0% found this document useful (0 votes)
9 views

Complexity of algorithms

The document outlines a final exam for a course on book club optimization, featuring multiple questions related to algorithm design for selecting books to satisfy club members. It includes tasks such as creating a 2-approximation algorithm, minimizing total costs with various proposed algorithms, and analyzing randomized algorithms. Additionally, it requires students to provide examples, pseudo code, and performance analysis for the algorithms discussed.

Uploaded by

Dorra Louati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Complexity of algorithms

The document outlines a final exam for a course on book club optimization, featuring multiple questions related to algorithm design for selecting books to satisfy club members. It includes tasks such as creating a 2-approximation algorithm, minimizing total costs with various proposed algorithms, and analyzing randomized algorithms. Additionally, it requires students to provide examples, pseudo code, and performance analysis for the algorithms discussed.

Uploaded by

Dorra Louati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CS441 Final Exam

Spring 25

Dorra Louati

Book Club Optimization


You are organizing a book club with m − 1 friends. You have access to a list of n
books. Each member (including yourself) submits a list of two books that they are
interested in reading. You want to create a reading list such that each member is
satisfied—that is, at least one of their chosen books is included in the final reading
list.

Question 1 (10pts): Minimum Number of Books


Design a 2-approximation algorithm to choose the smallest number of books such
that every member is satisfied. You may reduce this problem to the Vertex Cover
problem.

Question 2 (10pts): Minimizing Total Cost


Now each book has an associated cost (e.g., due to purchasing or borrowing). You
aim to minimize the total cost of books while still satisfying all members.
Three algorithms are proposed:

1. Algorithm Super-Naive: While there exists an unsatisfied member x, choose


the cheaper of x’s two books and add it to the reading list.

2. Algorithm Naive: While there exists an unsatisfied member x, add both of x’s
books to the reading list.

3. Algorithm Greedy: Let U be the set of unsatisfied members. Repeatedly pick


the book y minimizing

price(y)
,
#members from U satisfied by y

and remove all members satisfied by y from U .

1
Question 3 (10pts): Examples
Give examples showing that Algorithm Super Naive and Algorithm Naive do not
achieve a constant approximation factor.

Question 4 (20pts): Approximation Factor


Show that Algorithm Greedy achieves an approximation factor of O (n log n). You
must write down the full algorithm and analysis (use results from any problem you
saw in class).

Question 5 (5pts): Execution


Sketch the greedy Algorithm Execution Let there be 4 members and 5 books:

• Member 1: {B 1 , B 2 } (Book 1 or 2)

• Member 2: {B 2 , B 3 }

• Member 3: {B 3 , B 4 }

• Member 4: {B 4 , B 5 }

Book Costs

price(B 1 ) = 4, price(B 2 ) = 3, price(B 3 ) = 5, price(B 4 ) = 2, price(B 5 ) = 1

Question 6 (5pts): Randomized Algorithms


Explain the difference between Las Vegas and Monte Carlo algorithms. Give an ex-
ample of each.

Back to Book Selection Based on Randomized Solution


Instead of using the deterministic greedy strategy (which selects the book with the
lowest cost-to-coverage ratio), we now explore a randomized algorithm where, at
each step, we choose a book randomly with probability proportional to the number
of unsatisfied members it satisfies.

Questions 7 (10pts):
Writhe a pseudo code for this randomized algorithm.

2
Questions 8 (20pts) :
Analyze the expected performance in terms of total cost and member satisfaction.

1. Show that the expected Number of Iterations is

E[number of steps] ≤ O(k log n)

2. Show that
1 X T X
Expected Cost = price(b)
T t =1 b∈S t

where S t is the set of books selected in run t .

3. Let U t be the set of unsatisfied members at the end of run t ,Find the Satisfaction Ratet .

4. Find the Expected Satisfaction Rate.

5. Let k the size of the optimal solution that satisfies all members and if the ran-
domized algorithm runs for O(k log n) steps (i.e., selects O(k log n) books), give
a lower bound for the Probability of Full Satisfaction.

Questions 9 (10pts) :
Discuss your solutions

You might also like