Quant Memo
Advanced

The Odds Algorithm for Stopping on the Last Success

A clean rule for deciding when to stop and act, among a sequence of independent yes/no events, that maximizes your chance of stopping on the very last success — the same logic behind the classic secretary problem.

Suppose you observe a sequence of independent events one at a time — each either a "success" or not — and you must decide, on the spot, whether to stop at the current success or keep going, with no ability to go back. You want to maximize the chance you stop on the last success in the whole sequence. The odds algorithm (Bruss, 2000) gives an exact rule: at each step, compute the odds of success at that step (probability of success divided by probability of failure), sum those odds from the current step to the end, and stop at the first success once that remaining sum drops below 1.

The rule generalizes the classic secretary problem, where you interview candidates one by one and must accept or reject on the spot to maximize the chance of picking the single best candidate — that's the special case where each step's success probability is 1/k1/k for the kk-th candidate, and the odds algorithm's cutoff reproduces the familiar "reject the first 37% automatically, then take the next candidate better than all seen so far" rule.

Worked example

With independent success probabilities p1,,pnp_1, \ldots, p_n, the odds at step kk are rk=pk/(1pk)r_k = p_k / (1-p_k). If the sum of remaining odds rk+rk+1++rnr_k + r_{k+1} + \cdots + r_n is still above 1 at step kk, keep going even if step kk is a success; once that remaining sum first falls below 1, stop at the next success you see. For the secretary problem with n=100n=100 candidates, this threshold works out to roughly candidate 37 — reject the first 37 outright, then accept the next one who beats everyone seen so far.

The odds algorithm says: sum the "odds" of success (not the probabilities) over all remaining steps, and stop at the first success once that remaining sum drops below 1 — a single, exact stopping rule that maximizes the chance of stopping on the true last success, with the secretary problem as its most famous special case.

Practice in interviews

Further reading

  • Bruss, 'Sum the Odds to One and Stop' (2000)
ShareTwitterLinkedIn