The key idea: count what is still unproved
To prove which parcel is lightest, every other parcel must have lost a weighing: been the
lighter one at least once. Otherwise it could still be the lightest. To prove which is heaviest,
every other parcel must have won one. That is facts to establish. Call each one a
unit.
A weighing between two parcels that have never been weighed settles two units: one loses, one
wins. Any other weighing can be answered so that it settles at most one. So a good method weighs
fresh parcels in pairs first: weighings, two units each. Then the lighter of
each pair competes for lightest and the heavier for heaviest. For even that is
weighings; for odd , start with one parcel as both candidates and
get . For 6 parcels, 7.
The adversary, which is part C
Give every parcel a state: new, won only, lost only, or both. Answer each weighing to settle as
few units as possible. Two new parcels: one lighter, one heavier (two units, unavoidable). A new
parcel against one that has only won: the new one is lighter (one unit). A new parcel against
one that has only lost: the new one is heavier (one unit). Two that have only won: one of them
becomes "both" (one unit). Two that have only lost: likewise. Anything else is answered by what
earlier answers already force, or settles nothing.
To stay consistent, decide weights as you go: when a parcel must be heavier than everything so
far, give it a new largest weight; when it must be lighter, a new smallest one. A parcel that has
only won only ever gets heavier, and one that has only lost only ever gets lighter, so no earlier
answer is contradicted.
Now count. Only weighings between two new parcels settle two units, and there are at most
of them. The other units cost one weighing
each. In total, at least
weighings.
Why a fixed set of weights cannot be the adversary
An adversary that picks the weights in advance loses to a method that bets on that particular
order. Weigh against , against , and so on. If every answer agrees with the order,
weighings prove both the lightest and the heaviest. Part C's grader plays exactly that
bet. It first learns the order your adversary gives, then replays it against a fresh copy. An
adversary has to decide as it goes. That is also why a lower bound is a statement about the
worst case: on any one input, some lucky method is fast.
Going further
- The second lightest (part D) takes weighings: a knockout
tournament, then a knockout among the parcels that lost directly to the winner. Kislitsyn proved
this optimal (1964). The adversary keeps track of how many parcels each parcel has beaten,
directly or through others.
- Exact minimum-comparison selection for general ranks is still not settled. Knuth's
Sorting and Searching, section 5.3.3, collects what is known.
- The same counting of units proves lower bounds well beyond comparisons. Recognizing what
"still unproved" means is most of the work.
References
- I. Pohl. A sorting problem and its complexity. Communications of the ACM 15(6), 1972.
- S. S. Kislitsyn. On the selection of the th element of an ordered set by pairwise
comparisons. Sibirskii Matematicheskii Zhurnal 5, 1964.
- D. E. Knuth. The Art of Computer Programming, Volume 3: Sorting and Searching, 2nd edition,
section 5.3.3. Addison-Wesley, 1998.