Complexity of algorithms
Complexity of algorithms
Spring 25
Dorra Louati
2. Algorithm Naive: While there exists an unsatisfied member x, add both of x’s
books to the reading list.
price(y)
,
#members from U satisfied by y
1
Question 3 (10pts): Examples
Give examples showing that Algorithm Super Naive and Algorithm Naive do not
achieve a constant approximation factor.
• 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
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.
2. Show that
1 X T X
Expected Cost = price(b)
T t =1 b∈S t
3. Let U t be the set of unsatisfied members at the end of run t ,Find the Satisfaction Ratet .
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