/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none}

91Ó°ÊÓ

Let[m]denote the set{0,1,…,m−1}. For each of the following families of hash functions, say whether or not it is universal, and determine how many random bits are needed to choose a function from the family.

(a) H={ha1,a2:a1,a2∈[m]}, wheremis a fixed prime and

ha1·ha1,a2(x1,x2)=a1x1+a2x2modm

Notice that each of these functions has signatureha1,a2:[m]2→[m]that is, it maps a pair of integers in[m]to a single integer in[m].

(b) His as before, except that nowm=2kis some fixed power of.2

(c) His the set of all functionsf:[m]→[m−1].

Short Answer

Expert verified

a) It is proved that given family of hash functions,His universal.

b) It is required to choose two integers, the total number of random bits required to select a hash function is2kbits.

c) mlog(m−1)bits required to choose a function fromH.

Step by step solution

01

To prove that the family of hash function His universal

(a)

H={ha1,a2:a1,a2∈[m]}andha1,a2=i=12ai.ximodm=(a1x1+a2x2modm)

Assume thatx2≠y2.

Now, to proveH={ha1,a2:a1,a2∈[m]}is universal, it is required to find the probability

Pr[ha1,a2(x1,x2)=ha1,a2(y1,y2)]

Re write the above equation as follows:

a1(x1−y1)≡a2(y2−x2)modm

Selecta1randomly from[m] and assumec=a1(x1−y1).

Thena2≡c.(y2−x2)−1modm,

Now calculate the probability of selectingso that Equation(1)is true.

Thusa2≡c.(y2−x2)−1 mod mand obviouslycan be any one of the integers in.{0,1,…,m−1} That isa2,havepossible values.

Therefore, the probability of equation (1)holds is1m.

Hence it is proved that given family of hash functions,His universal.

02

Total number of random bits required to select a hash function is2k bits

(b)

Consider a family of hash functionsH={ha1,a2:a1,a2[m]} and

ha1,a2=∑i=12ai.ximodm=a1x1+a2x2modm

Wherem=2k(That is,mis even).

From part (a)H,is universal and(a1x1+a2x2)≡(a1y1+a2y2)modmholds when there exists a unique inverse modulomfor (y2−x2).

There will be a unique inverse modulomfor (y2−x2), only ifmis a prime number.

Sincem=2kand it is not a prime number (unlessk=1), there exist no unique inverse modulomfor.

(y2−x2)

ThusH,is not universal.

In order to select a hash function randomly from,H need to select two integers

a1and a2randomly from.[m] The set [m]has totalintegers.

To uniquely represent each number in set,[m] at most⌈logm⌉bits are required

Where,

⌈logm⌉bits=⌈log2k⌉=k bits.

Since it is required to choose two integers, the total number of random bits required to select a hash function is2k bits.

03

mlog(m−1)bits required to choose a function from HH

(c)

Consider a family of hash functionsf:[m]→[m−1].

In order to prove the above family of hash functions is universal, it is enough to prove that the probability of colliding any two data itemsxand yis1m−1, if the hash function is randomly chosen from the family of hash functions. Wherem−1is the number of buckets.

Assumex≠yand then calculateP=Pr[f(x)=f(y)].

The probability forf(x) can be any one of integers of[m−1] is1m−1.

Similarly, the probability forf(y)can be any one of integers of [m−1]is.1m−1

The probability for the outputs off(x)and f(y)are same is.data-custom-editor="chemistry" 1m−1×1m−1=1(m−1)2

However, there arem−1ways to be.f(x)=f(y)

That is(f(x)=0,1,2,…,m−2)=(f(y)=0,1,2,…m−2),(totalm−1ways)

Thus,P=∑i=1m−11(m−1)2

or

P=(m−1)×1(m−1)2P=1m−1

Therefore, it is proved thatHis universal.

Set [m]={0,1,2,…,m−1}can be mapped to set [m−1]={0,1,2,…,m−2}in(m−1)mways such that fis a function.

Thus, the total number of functions f:[m]→[m−1]is(m−1)m.

To uniquely represent each function inH, at most ⌈log(m−1)m⌉=mlog(m−1)bits are required.

Therefore,mlog(m−1)bits required to choose a function fromH.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91Ó°ÊÓ!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.