1

Fix an ambient finite set $X$, without loss of generality $X = \{1, \ldots, |X|\}$. You wish to identify some subset $B \subseteq X$ hidden to you. You can gain information about the subset as follows: you can choose any subset $C \subseteq X$, and you receive the number $|B \cap C|$.

In terms of $|X|$ (and possibly $|B|$), what is the least number of queries required to determine $B$? How about a special case, for example when $|B| \leq \log_2(|X|)$?


Some observations:

  • The case $|B| = 1$ allows binary search, and thus can be done in $\lceil\log_2(|X|)\rceil$. Already for $|B| = 2$, a way with fewer than $2\log_2(|X|) + C$ queries is not clear to me (although I can see how to do $\frac32 \log_2(|X|) + C$ on average).
  • Trivially $|X|$ queries always suffices: just start with $C = X$ and remove one element for each query.
  • This question was inspired by a recent Google Code Jam problem: there your query consists of a bit for each element of $X$, and you get $|X| - |B|$ bits back. However, in the Google Code Jam problem the returned bits are still ordered correctly, just with missing values. This allows you to match up the responses of multiple queries. Then $\lfloor\log_2(|B|) + 1\rfloor$ queries suffice.
Mees de Vries
  • 27,550
  • it seems from your first observation that you are told the value of $|B|$ before the algorithm? (because if you dont know $|B|=1$ you might not have used binary search) – antkam Apr 12 '19 at 13:21
  • Have you had a look at this question? You might find some info under the linked posts as well. – rss Apr 12 '19 at 16:09
  • @antkam, I don't care much either way. You can find out |B| with a single query, so it doesn't matter much to my question. – Mees de Vries Apr 12 '19 at 17:19
  • "find out |B| with a single query" -- haha, how did i not realize that? :) – antkam Apr 12 '19 at 17:23

0 Answers0