We have a set of n nuts and n bolts such that there are n unique pairs of nuts and bolts. There are.

We have a set of n nuts and n bolts such that there are n unique pairs of nuts and bolts. There are no measuring gauge available and the only way that we can test a nut against a bolt is to try and see if it exactly fits or the nut is oversized or the bolt is oversized. Design a strategy that minimizes the number of trials comparing a nut and a bolt. Note that two nuts or two bolts cannot be compared against each other directly.