سوال ۶۱ کنکور ارشد علوم کامپیوتر ۱۴۰۵
آرایه حاوی بیت است. فرض کنید یکی از دو گونه زیر است:
گونه ۱: نیمی از درایههای حاوی بیت صفر و نیم دیگر حاوی بیت ۱ (بدون ترتیب) است.
گونه ۲: در مجموع صفر و یک دارد.
بهشما آرایه داده شده است که میتواند از گونه ۱ یا ۲ باشد. در بدترین حالت، دستکم شما چندتا از درایههای را باید بررسی کنید تا گونهٔ آن را با اطمینان تشخیص دهید؟
پاسخ صحیح: گزینهٔ D —
This is an adversary (worst-case) argument. We must decide whether is Kind 1 (exactly zeros and ones) or Kind 2 (exactly zeros and ones) by probing individual bits.
Suppose we have probed some cells and seen ones and zeros. The observations stay consistent with each kind as long as the seen counts do not exceed that kind's totals:
- Consistent with Kind 1 iff and .
- Consistent with Kind 2 iff and .
Both kinds remain possible as long as the tighter bound on each bit value holds, namely and .
Adversary strategy. For each probe, answer while and answer while , keeping both kinds alive. This can be sustained for
probes (reaching ). After exactly probes the observations are still consistent with both kinds, so no algorithm can decide yet.
One more probe forces the answer. At the state there are unprobed cells. For Kind 1 every one of them must be a (we still need ones and more zeros); for Kind 2 every one must be a (we still need zeros and more ones). So the very next probe returns Kind 1, or Kind 2 — either way the kind is now certain.
Hence the worst case requires
probes, which is option 4.
Exam trick: In a two-hypothesis identification problem, the ambiguous region lasts while the counts respect the tighter bound on each symbol (, ); sum those to , then add the single decisive probe: .