# Questions & Answers of Hashing

## What is Hashing ?

A hash algorithm is a function that converts a data string into a numeric string output of fixed length. The output string is generally much smaller than the original data.

## Weightage of Hashing

Total 8 Questions have been asked from Hashing topic of Algorithms subject in previous GATE papers. Average marks 1.88.

Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?

Given a hash table T with 25 slots that stores 2000 elements, the load factor $\alpha$ for T is ______.

Consider a hash table with 9 slots. The hash function is h(k) = k mod 9. The collisions are resolved by chaining. The following 9 keys are inserted in the order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum, minimum, and average chain lengths in the hash table, respectively, are

Consider a hash table with 100 slots. Collisions are resolved using chaining. Assuming simple uniform hashing, what is the probability that the first 3 slots are unfilled after the first 3 insertions?

A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below

 0 1 2 42 3 23 4 34 5 52 6 46 7 33 8 9

Which one of the following choices gives a possible order in which the key values could have been inserted in the table?

A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below

 0 1 2 42 3 23 4 34 5 52 6 46 7 33 8 9

How many different insertion sequences of the key values using the same hash function and linear probing will result in the hash table shown above?