سوال ۵۶ کنکور ارشد مهندسی کامپیوتر ۱۴۰۳
گوییم یک خانواده از درهمسازهای سراسری (universal) است، هرگاه برای هر و داشته باشیم . اگر مجموعهٔ که فقط متشکل از توابعی به شکل است، یک خانوادهٔ درهمساز سراسری باشد، آنگاه در مورد تعداد عناصر چه میتوان گفت؟
پاسخ صحیح: گزینهٔ C — میتواند ۵۰۶ عضو داشته باشد.
This is the classic Carter–Wegman universal hash family
Conditions for universality. The family is provably universal only when is a prime (with and ). The parameters range as
Why : if then is a constant function — every pair of keys collides with probability — so is excluded. This leaves choices for and choices for , hence
Test each option — we need a value of the form with prime:
| Option | Value | Factor as | prime? | |
|---|---|---|---|---|
| 1 | no | |||
| 2 | no | |||
| 3 | yes | |||
| 4 | no |
Only has the form (prime) (prime ), with prime. So can have elements, and option 3 is correct.
Exam trick: The size of the Carter–Wegman family is where is the prime modulus. To spot the valid count, factor each candidate as a product of two consecutive integers and check that the larger factor is prime — only passes.