ProgrammingVery hard
With linear probing at load factor 0.75, the expected number of probes for an unsuccessful search, under uniform hashing, is what?
- A. 8.5
- B. 4.0
- C. 3.5
- D. 16
Correct answer: A. 8.5
Using (1 + 1 / (1 - a)^2) / 2 with a = 0.75 gives (1 + 16) / 2 = 8.5. This is why linear probing should keep the load low.
More C Programming questions
- A chained table has 10 buckets holding 20 keys, and a successful search examines the matching key uniformly at random. What is the…
- A table of size 10 uses linear probing. Keys 5, 15 and 25 are inserted in that order with h(k) = k % 10. How many slots are examined in…
- A quadratic probing table of size 8 starts at h = 2 and uses probe i checks (h + ii) % 8 for i = 0, 1, 2, 3. What index is checked at i = 2?
- A djb2-style string hash starts with h = 5381 and for each character computes h = h 33 + c (unsigned 32-bit wrap). What is the hash of "ab"?
- Which expression always gives a valid bucket index in the range 0 to m - 1 for a signed int key k, with m > 0?
- A chained hash table is resized by doubling whenever it becomes full, starting at capacity 1. Inserting 8 keys, how many element moves…