Skip to main content
1 of 3
Pat Devlin
  • 2.7k
  • 16
  • 21

A few quick thoughts.

  1. This is called the group testing problem. If folks wanted to learn more, I suppose they could look it up, but that might ruin the fun.

  2. I would really like to say that if you increase $p$, then the best algorithm only gets slower...

  3. The following algorithm works in at most $1 + 2np \log(n)$ steps on average, so for $p \leq n^{-c}$, this matches the information theory lower bound within a multiplicative constant.

(i) Initially test the entire set. (ii) If you test a set, and it contains at least one infected element, then cut the set into two almost equal-sized pieces, and recursively test each piece.

[To analyze that algorithm, perhaps consider the problem where we know that exactly $k$ elements are infected. Then the above algorithm tests at most $1+2k \lceil \lg(n) \rceil$ sets, where $\lg$ is the log base $2$ and $\lceil x \rceil$ denotes the ceiling function (to prove this bound, draw the binary tree of what is tested in this algorithm. Note that each infected element has at most $\lceil \lg(n) \rceil$ sets above it, and each of those contributes at most $2$ tests to the total count). Then just take the expected value of both sides, and we're done since the expected value of $k$ is $np$.]

For larger values of $p$ (e.g., $p = 1 / \log(n)$), I'm not sure what should be the truth. For all $p \geq 1/2$, I would like the answer to be $n$ (see point (1) above).

Pat Devlin
  • 2.7k
  • 16
  • 21