A set S={S1,S2,⋯,SM} of non-empty subsets of U such that ∣S∣=M
Question is to find a collection S′ from S of minimum size such that the union of sets in S′ covers all elements of U
Assumption: Union of all sets in S covers all elements of U
Brute force algorithm: Takes O(2M⋅M⋅N) time
Tries all possible 2M subsets of S
Given one such subset S′ we can check in O(M⋅N) time if union of all sets in S′ covers all elements of U
Each of the ≤M sets in S′ can have at most N elements each
Can we do better, say O(2N⋅N⋅M) time ?
Note that 1≤M≤2N
Setting up the recurrence for dynamic programming
For each non-empty subset X⊆U and each 1≤j≤M let OPT[X,j] be the size of minimum cardinality subset of {S1,S2,⋯,Sj} that covers all elements from X.