greedy_set_cover

# greedy_set_cover - Greedy algorithm for Set cover Input:...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Greedy algorithm for Set cover Input: Collection C of sets S 1 ; :::; S m over a universe U . Weight w i for each set S i . Output: a subcollection C of smallest possible total weight whose union is also U . Whatever we need to minimize, can naturally be thought of as a cost. So we can think of w i as being the price of S i , and we want to buy all elements in U by buying some of the sets while minimizing what we spend. The natural greedy idea is: Pick the set that gives the maximum number of elements for the money that you spend on it. Setcover( C; U ) f 1. Mark all elements of U \uncovered". 2. C = null. 3. while some elements are uncovered: For each S j = 2 C compute the per element covering cost c j = w j /number of uncovered elements in S j . Pick the set S k that has minimum c k . Include S k in C . Mark the uncovered elements in S k covered. 4. Return C g The analysis is quite direct, we bound N i the number of elements remaining uncovered at the end of iteration i . We de ne N to mean...
View Full Document

## This note was uploaded on 01/04/2010 for the course CSE CS601 taught by Professor Prof.ranade during the Summer '09 term at IIT Bombay.

### Page1 / 2

greedy_set_cover - Greedy algorithm for Set cover Input:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online