การรับประกัน ปัจจัยที่ǫสามารถเป็นค่าคงที่หรือการทำงานของขนาดของตัวอย่างเช่นการป้อนข้อมูลที่
Example 1.16 ǫ-Approximation for the bin packing problem. The bin packing
problem is an NP-hard combinatorial optimization problem. Given a set of objects of
different size and a finite number of bins of a given capacity. The problem consists in
packing the set of objects so as to minimize the number of used bins. Approximation
algorithms are generally greedy heuristics using the principle “hardest first, easiest last.”
The first fit greedy heuristic places each item into the first bin in which it will fit. The
complexity of the first fit algorithm is_(n • log(n)).Anexample of a good approximation
algorithm for the bin packing problem is obtained by the first fit descending heuristic
(FFD), which first sorts the objects into decreasing order by size: