Some “Hard” Problems are Easy
Example: Given a set of fields of a structure of length f1, f2, … ,fn in bytes. Can they be fit into two cache lines of length b bytes.
Critical observation: b is small, often 32 or 64.
Algorithm: Use the subset sum algorithm to find the largest c < b such that some subset of the fields fits exactly into c bytes. The remaining field lengths must sum to be < b.