ProgrammingHard
With 10^5 keys and a load factor of at most 0.5, what is the smallest power-of-two table size that works?
- A. 262144
- B. 131072
- C. 524288
- D. 200000
Correct answer: A. 262144
The table must hold at least 2 x 10^5 slots. 2^17 = 131072 is too small, and 2^18 = 262144 is the first power of two that is large enough.
More C Programming questions
- Keys 13 and 23 are inserted with linear probing into a table of size 10 with h(k) = k % 10. In which slot does 23 land?
- Keys 6, 1 and 11 are inserted with linear probing into a table of size 5, h(k) = k % 5. In which order do the keys appear when the table…
- With chaining, what is the expected number of nodes examined by an unsuccessful search when the load factor is 1.5?
- A hash table with 10 buckets receives 11 keys. What is the minimum number of collisions guaranteed?
- Which C code correctly inserts a node n at the front of bucket h of an array of struct node table[]?
- Which operation is needed to make open addressing deletions safe for later lookups?