Your turn to analyze an approximation algorithm for an NP-complete problem.
Bin Packing: Let x1 x2 ,…, xn be real numbers between 0 and 1. Partition them into as few subsets (bins) as possible such that the sum of numbers in each subset is at most 1.
Heuristic Solution: First Fit
- put x1 in first bin
- then, for each i, put xi in the first bin that has room for it, or start a new bin if there is no room in any of the used bins.
Prove that First Fit requires at most twice the optimal number of bins.