Problem. candidates arrive in random order. After each interview you learn only the candidate’s rank relative to those seen so far, and must immediately accept or reject — rejections are final. Maximise the probability of hiring the single best candidate.
The optimal strategy
Reject the first candidates, then accept the first one better than all of them.
The optimal cut-off is , and the success probability is
Remarkably, the probability does not decrease with — it converges to for every large .
The derivation
With cut-off , you win if the best candidate is at position and the best among the first lies in the first :
Maximise over : gives , with value . ∎
int optimalCutoff(int n) {
double best = 0; int bestK = 0;
for (int k = 1; k < n; k++) {
double p = 0;
for (int i = k + 1; i <= n; i++) p += (double)k / (n * (i - 1));
if (p > best) { best = p; bestK = k; }
}
return bestK;
}For the exact optimum is , with success probability .
Why keeps appearing
The same “explore then exploit” structure and the same constant show up throughout online decision-making:
| Problem | Constant |
|---|---|
| Secretary problem | |
| Online bipartite matching (RANKING) | |
| Max coverage greedy | |
| Submodular maximisation greedy | |
| Balls into bins, fraction of empty bins | |
| Derangements | |
| Random permutation with no short cycle | -flavoured |
The recurrence of is not a coincidence: it is , the probability of avoiding independent events each of probability .
Variants
| Variant | Optimal strategy / value |
|---|---|
| Maximise | reject , then take the first record — |
| Maximise the expected rank | a different, much better strategy; expected rank |
| Maximise the expected value (values known) | threshold rules; the prophet inequality gives |
| Accept the best or second best | higher success probability, two thresholds |
| Choose candidates | multiple-choice secretary; as grows |
| Values from a known distribution | a fixed threshold suffices |
| Rejections can be recalled | trivially solvable |
| unknown | randomised cut-off strategies |
| Arrivals not uniformly random | the guarantee breaks |
The prophet inequality
When the values (not just ranks) are drawn from known distributions, a single threshold with guarantees at least of the expected maximum. Simple, and the constant is tight.
This is the theoretical basis for reserve prices in auctions, and it is the “known distributions” counterpart to the rank-only secretary problem.
Online algorithms and competitive ratio
The secretary problem is the entry point to online algorithms, where decisions are irrevocable and the benchmark is the offline optimum:
| Online problem | Best ratio |
|---|---|
| Secretary | (probability of the best) |
| Online bipartite matching | |
| Ski rental | deterministic, randomised |
| Paging ( pages) | deterministic, randomised |
| Online load balancing | |
| List update | (move-to-front) |
Ski rental is the other classic worth knowing: rent for 1/day or buy for ; renting until you have spent , then buying, is 2-competitive, and randomising the switch point improves it to .
Why it is worth knowing
It is the cleanest demonstration that an optimal irrevocable strategy can be computed exactly, and that the answer is a clean constant independent of . The explore-then-exploit shape — sample a fraction, then commit to anything better — recurs throughout online algorithms and is worth recognising.
See also: Probability · Approximation Algorithms · Stable Marriage