Machine-translated by Google. Questions are authored in English.
Top

Hashing Techniques Questions and Answers

11.

Searching for an element in the hash table requires O(1) time for the ________ time, whereas for direct addressing it holds for the ________ time.

Exam Year(s)

UGC NET - 2014,

Answer: C

A hash table searches in O(1) time on the average, and direct addressing searches in O(1) time in the worst case. With hashing, collisions can make a search take longer in the worst case, but with good hashing the expected time is constant. With direct addressing, the key is the index of the table, so a search is one access even in the worst case. The other options invert this or name a best case, which is not the standard comparison. Direct addressing needs a table with one slot for every possible key, which is why its search time does not vary, whereas a hash table maps many keys to a smaller table and so can have collisions.

Please log in or register to report this question.

12.

If h is chosen from a universal collection of hash functions and is used to hash n keys into a table of size m, where \(n \le m\), the expected number of collisions involving a particular key K is

Exam Year(s)

UGC NET - 2014,

Answer: A

The expected number of collisions involving a particular key is less than 1.

For a universal family, each of the other \(n - 1\) keys collides with K with probability at most \(1/m\), so the expected number of collisions is at most \((n - 1)/m\), which is below 1 when \(n \le m\).

The bounds with \(\lg n\) or greater than 1 do not follow from universality. The bound comes from linearity of expectation: summing the collision probabilities of the other \(n - 1\) keys gives at most \((n - 1)/m\), which is under 1 for \(n \le m\).

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Hashing Techniques Questions and Answers || Hashing Techniques MCQ Questions and Answers || Hashing Techniques GK Questions and Answers || Hashing Techniques GK MCQ Questions || Hashing Techniques Multiple Choice Questions and Answers || Hashing Techniques GK || GK on Hashing Techniques || Data Structures and Algorithms Questions and Answers || Data Structures and Algorithms MCQ Questions and Answers || Data Structures and Algorithms GK Questions and Answers || GK on Data Structures and Algorithms