GATE Computer ScienceEasyGATE CS (PYQ pattern)
A hash table with chaining has m = 50 slots and stores n = 200 keys; each key is equally likely to be in any slot (simple uniform hashing). What is the expected number of elements examined in a successful search for a key chosen uniformly among the stored keys (counting the sought element itself)?
- A. 2.99
- B. 3.00
- C. 2.00
- D. 4.00
Correct answer: A. 2.99
The exact expectation is 1 + α/2 − α/(2n) = 1 + 2 − 0.01 = 2.99, i.e. 1 + (n − 1)/(2m). The commonly quoted 1 + α/2 = 3 drops the small −α/(2n) term.
More Algorithms questions
- Twenty distinct keys are hashed independently and uniformly into 100 slots. What is the expected number of keys that share their slot with…
- The closed intervals [1,4], [2,6], [3,5], [7,10], [8,12], [9,11], [13,15], [5,8], [10,14], [0,2] are given. What is the minimum number of…
- From index 0 of the array [3, 1, 4, 1, 2, 1, 1, 5, 2, 1, 1, 3, 1, 2, 1] you may jump forward at most a[i] positions from index i. What is…
- The array [12, 7, 9, 14, 5, 11, 8, 10, 6] must be split into 3 contiguous parts so that the largest part sum is as small as possible. What…
- Coupons of 6 equally likely types are drawn with replacement. What is the expected number of draws until 4 different types have been seen?
- Counting sort (stable, processing the input from right to left with cumulative counts) is applied to a = [4, 2, 2, 8, 3, 3, 1, 4, 2]. At…